mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 09:46:28 +08:00
workspace: add eslint-config package (#510)
This commit is contained in:
1 parent
e7945a104f
commit
65311529bd
28 files changed
+230
-267
No files matched your search
@@ -1,9 +1,9 @@
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
const path = require('path');
|
||||
|
||||
module.exports = {
|
||||
root: true,
|
||||
parser: '@typescript-eslint/parser',
|
||||
plugins: ['@typescript-eslint', 'react', 'simple-import-sort'],
|
||||
env: {
|
||||
browser: true,
|
||||
es6: true,
|
||||
@@ -11,9 +11,7 @@ module.exports = {
|
||||
commonjs: true,
|
||||
},
|
||||
extends: [
|
||||
'airbnb',
|
||||
'airbnb/hooks',
|
||||
'airbnb-typescript',
|
||||
'@hydrooj/eslint-config',
|
||||
],
|
||||
parserOptions: {
|
||||
sourceType: 'module',
|
||||
@@ -53,100 +51,19 @@ module.exports = {
|
||||
JQuery: true,
|
||||
},
|
||||
rules: {
|
||||
'react-hooks/exhaustive-deps': 'off',
|
||||
'@typescript-eslint/dot-notation': 'off',
|
||||
'@typescript-eslint/no-implied-eval': 'off',
|
||||
'@typescript-eslint/no-throw-literal': 'off',
|
||||
'@typescript-eslint/return-await': 'off',
|
||||
'@typescript-eslint/no-shadow': 'warn',
|
||||
'no-shadow': 'off',
|
||||
'guard-for-in': 'off',
|
||||
'@typescript-eslint/quotes': ['warn', 'single', { avoidEscape: true }],
|
||||
|
||||
// FIXME A bug with eslint-parser
|
||||
'template-curly-spacing': 'off',
|
||||
// FIXME A bug with eslint-plugin-react
|
||||
'react/no-unknown-property': ['error', { ignore: ['key'] }],
|
||||
// 'template-curly-spacing': 'off',
|
||||
|
||||
// Note: must disable the base rule as it can report incorrect errors
|
||||
'no-use-before-define': 'off',
|
||||
'@typescript-eslint/no-use-before-define': ['error'],
|
||||
'no-unused-vars': 'off',
|
||||
'@typescript-eslint/no-unused-vars': 'warn',
|
||||
|
||||
'@typescript-eslint/lines-between-class-members': [
|
||||
'error',
|
||||
'always',
|
||||
{ exceptAfterSingleLine: true },
|
||||
],
|
||||
|
||||
'lines-between-class-members': [
|
||||
'error',
|
||||
'always',
|
||||
{ exceptAfterSingleLine: true },
|
||||
],
|
||||
'comma-dangle': [
|
||||
'error',
|
||||
'always-multiline',
|
||||
],
|
||||
indent: [
|
||||
'error',
|
||||
'@typescript-eslint/indent': [
|
||||
'warn',
|
||||
2,
|
||||
{ SwitchCase: 1 },
|
||||
],
|
||||
'max-len': ['error', 150],
|
||||
quotes: ['warn', 'single', { avoidEscape: true }],
|
||||
'class-methods-use-this': 'off',
|
||||
'consistent-return': 'warn',
|
||||
'func-names': 'off',
|
||||
'function-paren-newline': 'off',
|
||||
'default-param-last': 'off',
|
||||
'import/first': 'off',
|
||||
'import/extensions': 'off',
|
||||
'import/no-extraneous-dependencies': 'off',
|
||||
'max-classes-per-file': 'off',
|
||||
'newline-per-chained-call': 'off',
|
||||
'no-empty': ['warn', { allowEmptyCatch: true }],
|
||||
'no-console': 'off',
|
||||
'no-continue': 'off',
|
||||
'no-mixed-operators': 'off',
|
||||
'no-multi-assign': 'off',
|
||||
'no-plusplus': 'off',
|
||||
'no-restricted-syntax': [
|
||||
'error',
|
||||
{
|
||||
selector: 'LabeledStatement',
|
||||
message: 'Labels are a form of GOTO; using them makes code confusing and hard to maintain and understand.',
|
||||
},
|
||||
{
|
||||
selector: 'WithStatement',
|
||||
message: '`with` is disallowed in strict mode because it makes code impossible to predict and optimize.',
|
||||
},
|
||||
],
|
||||
'no-underscore-dangle': 'off',
|
||||
'no-await-in-loop': 'off',
|
||||
'no-lonely-if': 'off',
|
||||
'no-nested-ternary': 'off',
|
||||
'no-param-reassign': 'off',
|
||||
'no-script-url': 'off',
|
||||
'no-bitwise': 'off',
|
||||
'react/prefer-stateless-function': 'off',
|
||||
'react/static-property-placement': 'off',
|
||||
'react/self-closing-comp': 'off',
|
||||
'react/prop-types': 'off',
|
||||
'react/jsx-filename-extension': 'off',
|
||||
'react/jsx-one-expression-per-line': 'off',
|
||||
'react/jsx-props-no-spreading': 'off',
|
||||
'react/no-string-refs': 'off',
|
||||
'react/require-default-props': 'off',
|
||||
'react/react-in-jsx-scope': 'off',
|
||||
'react/destructuring-assignment': 'off',
|
||||
'react/button-has-type': 'off',
|
||||
'react/forbid-prop-types': 'off',
|
||||
'jsx-a11y/no-static-element-interactions': 'off',
|
||||
'jsx-a11y/anchor-is-valid': 'off',
|
||||
'jsx-a11y/click-events-have-key-events': 'off',
|
||||
'jsx-a11y/label-has-associated-control': 'off',
|
||||
|
||||
'simple-import-sort/imports': [
|
||||
'warn',
|
||||
@@ -157,6 +74,5 @@ module.exports = {
|
||||
],
|
||||
},
|
||||
],
|
||||
'simple-import-sort/exports': 'off',
|
||||
},
|
||||
};
|
||||
Reference in new issue
Block a user