Skip to content

Instantly share code, notes, and snippets.

@bearzk
Last active February 20, 2024 21:03
Show Gist options
  • Save bearzk/29f397e66e65de7c59ef8871c3406b55 to your computer and use it in GitHub Desktop.
Save bearzk/29f397e66e65de7c59ef8871c3406b55 to your computer and use it in GitHub Desktop.
eslint example
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'
],
};
{
"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