Skip to content

Instantly share code, notes, and snippets.

@dennyjohnk
Created August 3, 2023 09:43
Show Gist options
  • Save dennyjohnk/5cbc58e28af3aa0cebb5f0582db17ea5 to your computer and use it in GitHub Desktop.
Save dennyjohnk/5cbc58e28af3aa0cebb5f0582db17ea5 to your computer and use it in GitHub Desktop.
.eslintrc.json React Ts
{
"parser": "@typescript-eslint/parser",
"parserOptions": {
"jsx": true,
"useJSXTextNode": true,
"project": "tsconfig.json",
"sourceType": "module"
},
"ignorePatterns": ["./mock-api/server.js", "*.config.js"],
"extends": [
"plugin:react/recommended",
"plugin:@typescript-eslint/recommended",
"plugin:prettier/recommended"
],
"plugins": [
"react",
"@typescript-eslint",
"prettier",
"react-hooks",
"simple-import-sort",
"import"
],
"rules": {
"jsx-quotes": [2, "prefer-double"],
"no-console": 2,
"comma-dangle": [
2,
{
"arrays": "always-multiline",
"objects": "always-multiline",
"imports": "always-multiline",
"exports": "always-multiline",
"functions": "never"
}
],
"max-len": [
2,
{
"code": 120,
"ignoreStrings": true,
"ignoreTemplateLiterals": true,
"ignoreRegExpLiterals": true
}
],
"simple-import-sort/imports": [
"error",
{
"groups": [
["^react"],
// Packages. (Things that start with a letter (or digit or underscore), or `@` followed by a letter.)
["^@?\\w"],
// Parent imports. Put `..` last.
["^\\.\\.(?!/?$)", "^\\.\\./?$"],
// Other relative imports. Put same-folder imports and `.` last.
["^\\./(?=.*/)(?!/?$)", "^\\.(?!/?$)", "^\\./?$"],
// Style imports.
["^.+\\.s?css$"],
// Side effect imports. eg: import './style.css'
["^\\u0000"]
]
}
],
"sort-imports": 0,
"import/first": "error",
"import/newline-after-import": "error",
"import/no-duplicates": "error",
"import/no-extraneous-dependencies": [
"error",
{
"devDependencies": true
}
],
"import/prefer-default-export": 0,
"import/no-named-as-default": 0,
"@typescript-eslint/explicit-function-return-type": 0,
"@typescript-eslint/no-explicit-any": 0,
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-unused-vars": [
0,
{
"args": "all",
"ignoreRestSiblings": true,
"argsIgnorePattern": "^_",
"varsIgnorePattern": "^_"
}
],
"@typescript-eslint/ban-ts-comment": 1,
"@typescript-eslint/no-non-null-assertion": 0,
"@typescript-eslint/naming-convention": [
"error",
{
"selector": "default",
"format": ["camelCase"]
},
{
"selector": "variable",
"format": ["camelCase", "UPPER_CASE", "snake_case"],
"leadingUnderscore": "allowSingleOrDouble"
},
{
"selector": "variable",
"types": ["function"],
"format": ["PascalCase", "camelCase"],
"leadingUnderscore": "allowSingleOrDouble"
},
{
"selector": "function",
"format": ["camelCase", "PascalCase"],
"leadingUnderscore": "allowSingleOrDouble"
},
{
"selector": "parameter",
"format": ["camelCase", "snake_case"],
"leadingUnderscore": "allowSingleOrDouble"
},
{
"selector": "property",
"format": ["camelCase", "PascalCase", "snake_case"],
"leadingUnderscore": "allowSingleOrDouble"
},
{
"selector": "typeLike",
"format": ["PascalCase"]
},
{
"selector": "enumMember",
"format": ["camelCase", "UPPER_CASE"]
}
],
"react/prop-types": 0,
"react-hooks/rules-of-hooks": 0,
"react-hooks/exhaustive-deps": 1,
"prettier/prettier": [
2,
{
"trailingComma": "es5",
"singleQuote": false,
"semi": true,
"arrowParens": "always"
}
]
},
"settings": {
"react": {
"pragma": "React",
"version": "detect"
}
},
"env": {
"browser": true,
"es6": true
},
"globals": {
"module": true,
"global": true,
"window": true,
"process": true,
"Promise": true,
"Atomics": "readonly",
"SharedArrayBuffer": "readonly"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment