Last active
February 20, 2024 21:03
-
-
Save bearzk/29f397e66e65de7c59ef8871c3406b55 to your computer and use it in GitHub Desktop.
eslint example
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 = { | |
'env': { | |
'browser': true, | |
'es2021': true | |
}, | |
'extends': [ | |
// "standard-with-typescript", | |
'eslint:recommended', | |
'plugin:react/recommended', | |
'plugin:import/errors', | |
'plugin:import/warnings', | |
'plugin:@typescript-eslint/recommended' | |
], | |
settings: { | |
'import/resolver': { | |
alias: { | |
map: [ | |
['@', './resources/js'] | |
], | |
extensions: ['.js', '.jsx', '.json', '.ts', '.tsx', '.d.ts'], | |
}, | |
}, | |
}, | |
'overrides': [ | |
{ | |
'env': { | |
'node': true | |
}, | |
'files': [ | |
'.eslintrc.{js,cjs}' | |
], | |
'parserOptions': { | |
'sourceType': 'script' | |
}, | |
} | |
], | |
'parserOptions': { | |
'ecmaVersion': 'latest', | |
'sourceType': 'module', | |
project: 'tsconfig.json', | |
}, | |
'plugins': [ | |
'react', | |
'@typescript-eslint', | |
'import' | |
], | |
'rules': { | |
'react/react-in-jsx-scope': 'off', | |
'react/jsx-uses-react': 'off', | |
"react/no-unescaped-entities": "off", | |
'array-element-newline': ['error', 'consistent'], | |
'array-bracket-spacing': ['error', 'never'], | |
'eol-last': ['error', 'always'], | |
'eqeqeq': ['error', 'always'], | |
'indent': ['error', 2], | |
'no-multiple-empty-lines': ['error', { 'max': 1 }], | |
'no-trailing-spaces': 'error', | |
'object-curly-spacing': ['error', 'always'], | |
'quotes': ['error', 'single'], | |
'semi': ['error', 'always'], | |
"import/order": [ | |
"error", | |
{ | |
"groups": ["builtin", "external", "parent", "sibling", "index"], | |
"pathGroups": [ | |
{ | |
"pattern": "react", | |
"group": "external", | |
"position": "before" | |
} | |
], | |
"pathGroupsExcludedImportTypes": ["react"], | |
"newlines-between": "always", | |
"alphabetize": { | |
"order": "asc", | |
"caseInsensitive": true | |
} | |
} | |
] | |
}, | |
'ignorePatterns': [ | |
'.eslintrc.cjs', | |
'vite.config.js' | |
], | |
}; |
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
{ | |
"devDependencies": { | |
"eslint-plugin-import": "2.29.1" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment