Skip to content

Instantly share code, notes, and snippets.

@mathieutu
Created March 25, 2020 18:12
Show Gist options
  • Save mathieutu/052b01678566fccab69f9b30d91ad64f to your computer and use it in GitHub Desktop.
Save mathieutu/052b01678566fccab69f9b30d91ad64f to your computer and use it in GitHub Desktop.
config Eslint
module.exports = {
parser: '@typescript-eslint/parser',
extends: ['airbnb', 'plugin:@typescript-eslint/recommended'],
plugins: ['@typescript-eslint/eslint-plugin', 'react-hooks'],
env: {
browser: true,
node: true,
jest: true,
},
rules: {
semi: ['error', 'never'],
indent: 'off',
'max-len': ['error', 120],
'import/extensions': 'off',
'react/jsx-filename-extension': ['error', { extensions: ['.tsx'] }],
'react/jsx-props-no-spreading': 'off',
'@typescript-eslint/indent': ['error', 2],
'@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/prefer-interface': 'off',
'@typescript-eslint/no-unused-vars': ['error', {
ignoreRestSiblings: true,
}],
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/member-delimiter-style': ['error', {
multiline: {
delimiter: 'comma',
requireLast: true,
},
singleline: {
delimiter: 'comma',
requireLast: false,
},
}],
'no-console': 'error',
'object-curly-newline': 'off',
'import/prefer-default-export': 'off',
'import/no-default-export': 'error',
'react/prop-types': 'off',
'spaced-comment': ['error', 'always', { 'markers': ['/'] }],
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'warn',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/ban-ts-ignore': 'off',
'react/jsx-one-expression-per-line': 'off',
'react/state-in-constructor': ['error', 'never'],
'arrow-parens': 'off', // Erreur avec les generics de TS.
'react/destructuring-assignment': 'off',
'no-restricted-syntax': ['error', {
selector: 'CallExpression[callee.name=\'dump\']',
message: 'Dump expresions are not allowed',
}, {
selector: 'CallExpression[callee.name=\'dumpParams\']',
message: 'Dump expresions are not allowed',
}],
'import/no-extraneous-dependencies': ['error', {
'devDependencies': [
'webpack.config.js',
'cypress/**/*.{js,ts}',
],
}],
},
overrides: [{
files: ['**/*.js'],
rules: {
semi: ['error', 'always'],
},
}, {
files: ['src/store/**/*'],
rules: {
'no-param-reassign': 'off',
'import/no-default-export': 'off',
},
}],
settings: {
'import/resolver': {
node: {
extensions: ['.json', '.d.ts', '.ts', '.tsx', '.js'],
moduleDirectory: ['node_modules', 'src/'],
},
},
},
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment