Skip to content

Commit

Permalink
style: lint 규칙에 맞춰 포맷
Browse files Browse the repository at this point in the history
  • Loading branch information
Xvezda committed Dec 15, 2021
1 parent 4866e04 commit 567b869
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 48 deletions.
62 changes: 31 additions & 31 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,40 +1,40 @@
module.exports = {
"env": {
"browser": true,
"node": true,
"es2021": true,
"jest": true
'env': {
'browser': true,
'node': true,
'es2021': true,
'jest': true
},
"extends": "eslint:recommended",
"parserOptions": {
"ecmaVersion": 13,
"sourceType": "module"
'extends': 'eslint:recommended',
'parserOptions': {
'ecmaVersion': 13,
'sourceType': 'module'
},
"ignorePatterns": ["**/dist/*.js"],
"rules": {
"semi": "error",
"quotes": ["error", "single"],
"indent": [
"error", 2, {
"MemberExpression": "off",
"SwitchCase": 1,
"CallExpression": {"arguments": 1},
"VariableDeclarator": "first",
"ignoredNodes": [
"TaggedTemplateExpression[tag.name='html'] *",
"MemberExpression CallExpression[arguments]"
'ignorePatterns': ['**/dist/*.js'],
'rules': {
'semi': 'error',
'quotes': ['error', 'single', {'avoidEscape': true}],
'indent': [
'error', 2, {
'MemberExpression': 'off',
'SwitchCase': 1,
'CallExpression': {'arguments': 1},
'VariableDeclarator': 'first',
'ignoredNodes': [
'TaggedTemplateExpression[tag.name="html"] *',
'MemberExpression CallExpression[arguments]'
],
}
],
"max-len": [
"error", {
"code": 80,
"ignoreComments": true,
"ignoreTrailingComments": true,
"ignoreUrls": true,
"ignoreStrings": true,
"ignoreTemplateLiterals": true,
"ignoreRegExpLiterals": true,
'max-len': [
'error', {
'code': 80,
'ignoreComments': true,
'ignoreTrailingComments': true,
'ignoreUrls': true,
'ignoreStrings': true,
'ignoreTemplateLiterals': true,
'ignoreRegExpLiterals': true,
}
]
}
Expand Down
7 changes: 3 additions & 4 deletions examples/basic-routing/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ function Counter() {
`;
}

function Foo(props) {

function Foo() {
useEffect(() => {
document.title = 'Foo page';
});
Expand All @@ -59,7 +58,7 @@ function Foo(props) {
`;
}

function Bar(props) {
function Bar() {
useEffect(() => {
document.title = 'Bar page';
});
Expand All @@ -72,7 +71,7 @@ function Bar(props) {
`;
}

function Main(props) {
function Main() {
useEffect(() => {
document.title = 'Main page';
});
Expand Down
2 changes: 1 addition & 1 deletion examples/tic-tac-toe/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ function Board(props) {
`;
}

function Game(props) {
function Game() {
const [state, setState] = useState({
history: [
{
Expand Down
2 changes: 1 addition & 1 deletion packages/vomjs/src/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@ export function bind(component) {
bindedMap.set(component, component.bind(null, attrs));
attrsMap.set(component, attrs);
return bindedMap.get(component);
}
};
}
7 changes: 2 additions & 5 deletions packages/vomjs/src/hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ function stateful(hook) {
return function (...args) {
++idx;
return hook(...args);
}
};
}

export const useMemo = stateful((callback, deps) => {
Expand Down Expand Up @@ -64,7 +64,7 @@ export const useState = stateful((initState) => {
states[idx] = {
component: latest,
state: callIfFunction(initState),
}
};
}
const curIdx = idx;
return [
Expand All @@ -88,7 +88,6 @@ whenRender(() => {
cleanups.splice(0, cleanups.length);
});
export const useEffect = stateful((didUpdate, deps) => {
const latest = getLatestFunction();
const didCalled = typeof states[idx] !== 'undefined';
const needUpdate = !didCalled || typeof deps === 'undefined';

Expand All @@ -115,8 +114,6 @@ export const useEffect = stateful((didUpdate, deps) => {


export const useRef = stateful((initValue) => {
const latest = getLatestFunction();

let ref, refHash;
if (!states[idx]) {
refHash = getHash();
Expand Down
3 changes: 1 addition & 2 deletions packages/vomjs/src/shared.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ export class Template {
constructor(strings, args) {
exprFunctions.clear();

const result = strings[0] + strings.slice(1).reduce(
(acc, v, i) =>
const result = strings[0] + strings.slice(1).reduce((acc, v, i) =>
{
const expr = args[i];
return acc + exprToString(expr) + v;
Expand Down
8 changes: 4 additions & 4 deletions scripts/defineSandbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,8 @@ async function listExamples(baseDir) {
))
);
return packages
.filter(package => package.status === 'fulfilled')
.map(package => package.value);
.filter(pkg => pkg.status === 'fulfilled')
.map(pkg => pkg.value);
}

async function defineExamples(files='examples') {
Expand Down Expand Up @@ -173,7 +173,7 @@ async function getProjectRoot() {
}

async function getLatestHash() {
const { stdout } = await execPromise(`git log -1 --pretty='format:%h'`);
const { stdout } = await execPromise("git log -1 --pretty='format:%h'");
return stdout.trim();
}

Expand All @@ -188,7 +188,7 @@ async function main(argv) {
const readmeTemplate = baseTemplatePath + '.ejs';

const demos = await defineExamples();
const rendered = await renderFile(readmeTemplate, { demos }, {})
const rendered = await renderFile(readmeTemplate, { demos }, {});

const readme = baseTemplatePath + '.md';
await writeFile(readme, rendered);
Expand Down

0 comments on commit 567b869

Please sign in to comment.