A ESLint rule set for Toyokumo.
- Standardization of coding style.
- Installation and setting support for ESLint.
Based on airbnb
- Additional settings are not overwritten, merge into eslint-config-airbnb-base.
- If we disagree with the rules of airbnb, we will not follow them.
- This policy might be changed.
no-param-reassign rule is allowed for props.
const xs = [{ a: 1 }, { a: 2 }];
// ok
xs.forEach((x) => { x.a = 0 });
no-unused-vars rule is allowed for strings matched ^_+$
.
// ok
const f = (_, x) => x;
named export is recommended over default export.
// bad
export default function foo() {}
// good
export function foo() {}
- All rules provided by toyokumo/eslint-config assume the use of prettier.
- Install and use @toyokumo/prettier-config
- Use prettier-config-plugin to avoid lint errors where it overlaps with prettier format rules.
- If we find a red squiggly line, we will want to fix it, but we don't have to manually fix what we can fix by formatting
- For the lint + format method, refer to the method of this repository.
- This policy might be changed.
@toyokumo/eslint-config
- Base rule set. At least use this.
@toyokumo/eslint-config/rules/typescript.js
- Support of typescript for
*.ts
files.
- Support of typescript for
@toyokumo/eslint-config/rules/vue2.js
- Support of vue2 for
*.vue
files.
- Support of vue2 for
@toyokumo/eslint-config/rules/vue2-typescript.js
- Support of vue2 with typescript in script tag for
*.vue
files.
- Support of vue2 with typescript in script tag for
@toyokumo/eslint-config/rules/jest.js
- Support of jest.
We just set the ideal rule set, so we can overwrite or ignore the rule depending on the project situation.
module.exports = {
extends: [
'@toyokumo/eslint-config',
'@toyokumo/eslint-config/rules/typescript.js',
'@toyokumo/eslint-config/rules/vue2-typescript.js',
'@toyokumo/eslint-config/rules/jest.js',
],
rules: {
// too many default export in project.
'import/no-default-export': 'off',
},
overrides: [
{
files: '*.ts',
rules: {
// too many any in project.
'@typescript-eslint/no-explicit-any': 'off',
},
},
{
files: '*.vue',
rules: {
// too many any in project.
'@typescript-eslint/no-explicit-any': 'off',
},
},
],
};