Last active
August 6, 2019 05:25
-
-
Save gfx/778c112976321fd24e915fc7ba67aab5 to your computer and use it in GitHub Desktop.
Kibela's eslint / prettier config files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = { | |
extends: [ | |
// https://eslint.org/docs/rules/ | |
"eslint:recommended", | |
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/src/configs/recommended.json | |
"plugin:@typescript-eslint/recommended", | |
// https://prettier.io/docs/en/eslint.html | |
"plugin:prettier/recommended", | |
// https://github.com/yannickcr/eslint-plugin-react | |
"plugin:react/recommended", | |
// https://github.com/benmosher/eslint-plugin-import | |
// some import rules are too heavy, so do not use bundled rules. | |
"plugin:import/typescript", | |
], | |
// https://reactjs.org/docs/hooks-rules.html | |
plugins: ["react-hooks", "eslint-plugin-import"], | |
parser: "@typescript-eslint/parser", | |
parserOptions: { | |
project: "./tsconfig.json", | |
}, | |
settings: { | |
"react": { | |
version: "detect", | |
}, | |
"import/parsers": { | |
"@typescript-eslint/parser": [ ".ts", ".tsx" ], | |
} | |
}, | |
rules: { | |
"no-undef": "off", // useless in TypeScript | |
"no-console": "off", // console is removed in minification, anyway | |
"no-constant-condition": ["warn", { checkLoops: false }], | |
"no-useless-escape": "off", | |
"no-return-await": "warn", | |
"no-var": "warn", | |
"prefer-const": "warn", | |
"valid-typeof": "warn", | |
"curly": "warn", | |
"no-prototype-builtins": "warn", | |
"react/prop-types": "off", // useless in TypeScript | |
"react/jsx-handler-names": "warn", // TODO: "error" in a future | |
"react/button-has-type": "warn", // TODO: "error" in a future | |
"react/no-unsafe": "warn", // TODO: "error" in a future | |
"react/jsx-no-target-blank": "warn", | |
"react/display-name": "off", // TODO: because it has false positives | |
"react-hooks/rules-of-hooks": "error", | |
"react-hooks/exhaustive-deps": "warn", | |
"import/no-default-export": "error", | |
"import/no-cycle": "warn", | |
"import/no-deprecated": "warn", | |
"import/no-dynamic-require": "warn", | |
"@typescript-eslint/no-unused-vars": ["warn", { argsIgnorePattern: "^_|^intl$" }], | |
"@typescript-eslint/array-type": ["error", "generic"], | |
"@typescript-eslint/camelcase": "warn", | |
"@typescript-eslint/class-name-casing": "warn", // to allow the initial underscore | |
"@typescript-eslint/no-use-before-define": "warn", // NOTE: pay attention to it because it may cause unexpected behavior | |
"@typescript-eslint/no-non-null-assertion": "warn", // NOTE: pay attention to it because it may cause unexpected behavior | |
"@typescript-eslint/prefer-for-of": "warn", | |
"@typescript-eslint/prefer-includes": "warn", | |
"@typescript-eslint/prefer-string-starts-ends-with": "warn", | |
"@typescript-eslint/await-thenable": "warn", | |
"@typescript-eslint/no-for-in-array": "warn", | |
"@typescript-eslint/prefer-readonly": "warn", | |
"@typescript-eslint/prefer-regexp-exec": "warn", | |
// the following rules are enabled in "recommended" rule set but not useful here | |
"@typescript-eslint/indent": "off", | |
"@typescript-eslint/no-explicit-any": "off", | |
"@typescript-eslint/explicit-function-return-type": "off", | |
"@typescript-eslint/explicit-member-accessibility": "off", | |
"@typescript-eslint/no-object-literal-type-assertion": "off", | |
"@typescript-eslint/no-empty-interface": "off", | |
"@typescript-eslint/no-parameter-properties": "off", | |
"@typescript-eslint/prefer-interface": "off", | |
"@typescript-eslint/no-var-requires": "off", | |
// prettier is "error" by default but it's too strict | |
"prettier/prettier": "warn", | |
}, | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://prettier.io/docs/en/options.html | |
module.exports = { | |
printWidth: 120, | |
trailingComma: "all", | |
arrowParens: "always", | |
quoteProps: "preserve", | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment