Skip to content

Instantly share code, notes, and snippets.

@feeedback
Last active May 12, 2022 16:32
Show Gist options
  • Save feeedback/f566d2895b743e89ff63e48b1212c009 to your computer and use it in GitHub Desktop.
Save feeedback/f566d2895b743e89ff63e48b1212c009 to your computer and use it in GitHub Desktop.
my eslint config
// package.json
// "devDependencies": {
// "eslint": "^8.2.0",
// "eslint-config-airbnb-base": "^14.2.1",
// "eslint-config-prettier": "^8.3.0",
// "eslint-plugin-import": "^2.25.2",
// "eslint-plugin-prettier": "^4.0.0",
// "eslint-plugin-svelte3": "^4.0.0",
// "prettier": "^2.4.1"
// }
// .prettierrc
// {
// "singleQuote": true,
// "arrowParens": "always",
// "tabWidth": 2,
// "printWidth": 120,
// "trailingComma": "es5",
// "semi": true
// }
module.exports = {
root: true,
env: {
browser: true,
node: true,
es2020: true,
jest: true,
},
extends: ['eslint:recommended', 'airbnb-base', 'prettier'],
plugins: ['prettier', 'svelte3'],
overrides: [
{
files: ['**/*.svelte'],
processor: 'svelte3/svelte3',
rules: {
'import/prefer-default-export': 'off',
'import/first': 'off',
'import/no-mutable-exports': 'off',
'prettier/prettier': 'off',
},
},
],
globals: {},
parserOptions: {
ecmaVersion: 2022,
sourceType: 'module',
},
// parser: 'babel-eslint',
rules: {
'no-await-in-loop': 'off',
'dot-notation': 'off',
'no-console': 'off',
'no-continue': 'off',
'linebreak-style': 'off',
'prettier/prettier': [
'error',
{
endOfLine: 'auto',
trailingComma: 'es5',
},
],
'no-underscore-dangle': 'off',
'default-case': 'off',
'import/prefer-default-export': 'off',
'import/extensions': ['error', 'always', { ignorePackages: true }],
'max-len': [
1,
{
code: 120,
ignoreUrls: true,
ignoreStrings: true,
ignoreTemplateLiterals: true,
ignoreComments: true,
ignoreRegExpLiterals: true,
},
],
'no-bitwise': ['error', { int32Hint: true }],
'operator-assignment': ['error', 'always'],
'no-plusplus': ['error', { allowForLoopAfterthoughts: true }],
'no-restricted-syntax': ['off', 'ForOfStatement'],
'arrow-parens': ['error', 'always'],
'no-global-assign': ['error', { exceptions: ['Object'] }],
'no-extend-native': ['error', { exceptions: ['Object'] }],
'no-redeclare': ['error', { builtinGlobals: true }],
'block-scoped-var': ['error'],
// 'dot-notation': ['error', { allowPattern: '^.*[^a-zA-Z0-9]+.*$' }],
'class-methods-use-this': 'warn',
'no-unused-vars': ['error', { args: 'none' }],
'no-use-before-define': ['error', { classes: false }],
camelcase: ['error', { properties: 'never', ignoreDestructuring: true }],
'max-lines': ['error', { max: 200, skipBlankLines: true }],
'max-lines-per-function': ['error', { max: 70, skipBlankLines: true }],
'max-depth': ['error', 3],
'max-statements': ['error', 30, { ignoreTopLevelFunctions: true }],
complexity: ['error', { max: 9 }],
'max-nested-callbacks': ['error', 3],
},
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment