Skip to content

Instantly share code, notes, and snippets.

@Lippiece
Last active November 17, 2022 17:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Lippiece/4eccfbf942cef040c9664213bdef0f5d to your computer and use it in GitHub Desktop.
Save Lippiece/4eccfbf942cef040c9664213bdef0f5d to your computer and use it in GitHub Desktop.
My eslint config
env:
amd : true
browser : true
node : true
es2021 : true
es6 : true
worker : true
jest/globals: true
parser: "@babel/eslint-parser"
settings:
react:
version: "detect"
parserOptions:
requireConfigFile: false
sourceType: module
babelOptions:
configFile: false
babelrc: false
plugins:
- sonarjs
- regexp
- write-good-comments
- editorconfig
- unicorn
- github
- align-assignments
- html
- yaml
- no-loops
- immutable
- fp
- prefer-arrow
- "@babel"
- "@getify/proper-arrows"
- promise
- sort-keys-fix
- no-secrets
- no-unsanitized
- simple-import-sort
- "sort-keys-fix"
- jest
- react-hooks
overrides:
- files:
- tests/**
plugins:
- jest
extends:
- plugin:jest/all
rules:
jest/unbound-method: 0
- files:
- "*.json"
plugins:
- json-format
settings:
json/sort-package-json: true
json/ignore-files:
- "**/package-lock.json"
- "**/yarn.lock"
extends:
- "eslint:all"
- "plugin:github/recommended"
- "plugin:regexp/recommended"
- "plugin:sonarjs/recommended"
- "plugin:editorconfig/all"
- "plugin:unicorn/recommended"
- "airbnb"
- "airbnb-base"
- "plugin:yaml/recommended"
- "plugin:fp/recommended"
- "plugin:promise/recommended"
- "plugin:no-unsanitized/DOM"
- "plugin:security/recommended"
- "plugin:react/recommended"
- "plugin:react/jsx-runtime"
- "plugin:react-hookrecommended"
- "plugin:import/recommended"
ignorePatterns: ['/node_modules/', '*.spec.js', '*webpack*']
rules:
# OFF =========================================================== OFF
i18n-text/no-en:
- 'off'
- {}
no-console : 0
one-var : 0
no-multi-spaces : 0
no-return-assign : 0
array-callback-return : 0
no-ternary : 0
capitalized-comments : 0
sort-keys : 0
sort-imports : 0
no-underscore-dangle : 0
indent : 0
array-element-newline : 0
array-bracket-newline : 0
no-unused-vars : 0
no-inner-declarations : 0
"@babel/no-unused-expressions": 0
import/no-unresolved : 0
prettier/prettier : 0 # fuck you prettier
remove-empty/import : 0
filenames/match-regex : 0
unicorn/new-for-builtins : 0
unicorn/throw-new-2 : 0
immutable/no-let : 0
immutable/no-this : 0
immutable/no-mutation : 0
no-return-await : 0
no-extra-parens : 0
no-unused-expressions : 0
no-use-before-define : 0
"@getify/proper-arrows/return": 0
no-nested-ternary : 0
object-curly-spacing : 0
react/jsx-equals-spacing : 0
react/jsx-filename-extension : 0
# OFF =========================================================== OFF
# WARN ========================================================== WARN
react/jsx-indent: 1
react/function-component-definition:
- 1
- namedComponents: arrow-function
react/jsx-one-expression-per-line: 1
editorconfig/indent : 1
editorconfig/eol-last : 1
editorconfig/no-trailing-spaces : 1
prefer-arrow/prefer-arrow-functions:
- 1
- disallowPrototype : true
singleReturnOnly : false
classPropertiesAllowed: false
function-paren-newline:
- 1
computed-property-spacing:
- 1
- always
space-infix-ops : 1
arrow-body-style : 1
sort-keys-fix/sort-keys-fix: 1
jest/consistent-test-it:
- 1
- fn: test
unicorn/empty-brace-spaces: 1
no-confusing-arrow : 1
keyword-spacing : 1
arrow-parens:
- 1
- as-needed
implicit-arrow-linebreak:
- 1
- below
array-bracket-spacing:
- 1
- always
align-assignments/align-assignments:
- 1
- requiresOnly: false
unicorn/no-array-reduce:
- 1
- allowSimpleOperations: true
key-spacing:
- 1
- align: colon
dot-notation : 1
no-else-return : 1
no-lonely-if : 1
no-unneeded-ternary : 1
no-useless-rename : 1
no-useless-return : 1
no-var : 1
operator-assignment : 1
prefer-numeric-literals : 1
prefer-object-spread : 1
prefer-template : 1
spaced-comment : 1
operator-linebreak:
- 1
- before
no-multiple-empty-lines:
- 1
- max: 1
template-curly-spacing:
- 1
- always
newline-per-chained-call:
- 1
- ignoreChainWithDepth: 1
dot-location:
- 1
- property
comma-dangle:
- 1
- arrays : always-multiline
objects : always-multiline
imports : always-multiline
exports : always-multiline
functions: never
object-shorthand:
- 1
- always
linebreak-style:
- 1
- unix
multiline-comment-style:
- 1
- bare-block
eqeqeq:
- 1
- smart
quotes:
- 1
- double
semi:
- 1
- always
- omitLastInOneLineBlock: true
one-var-declaration-per-line:
- 1
- always
"@babel/object-curly-spacing":
- 1
- always
- objectsInObjects: true
arraysInObjects: true
semi-style:
- 1
- last
space-before-function-paren:
- 1
- never
block-spacing: 1
space-in-parens:
- 1
- always
curly:
- 1
- multi-line
object-curly-newline:
- 1
- multiline: true
comma-spacing:
- 1
- before: false
after: true
lines-around-comment:
- 1
- beforeLineComment : true
afterLineComment : false
afterBlockComment : false
beforeBlockComment: false
allowBlockStart : true
allowBlockEnd : true
allowClassStart : true
allowClassEnd : true
allowObjectStart : true
allowObjectEnd : true
allowArrayStart : true
allowArrayEnd : true
padded-blocks:
- 1
- always
- allowSingleLineBlocks : true
no-trailing-spaces : 1
simple-import-sort/imports : 1
simple-import-sort/exports : 1
eol-last : 1
arrow-spacing : 1
no-extra-semi : 1
unicorn/numeric-separators-style: 1
brace-style : 1
# WARN ========================================================== WARN
# ERROR ========================================================= ERROR
consistent-return:
- 2
- treatUndefinedAsUnspecified: true
"sonarjs/cognitive-complexity":
- 2
- 10
"@babel/new-cap":
- 2
- capIsNew: false
func-style:
- 2
- expression
- allowArrowFunctions : true
camelcase : 2
func-name-matching : 2
write-good-comments/write-good-comments: 2
no-alert : 2
"@babel/no-invalid-this" : 2
no-mixed-operators : 2
no-new-object : 2
no-useless-concat : 2
no-useless-constructor : 2
prefer-regex-literals : 2
prefer-spread : 2
getter-return:
- 2
- allowImplicit: true
line-comment-position:
- 2
- position: above
max-statements-per-line:
- 2
- max: 2
id-length:
- 2
- min: 3
exceptions:
- src
- url
- use
- key
- alt
- id
- fp
- _
- __
max-lines-per-function:
- 2
- max: 30
skipBlankLines: true
skipComments: true
no-mixed-spaces-and-tabs:
- 2
- smart-tabs
complexity:
- 2
- 2
no-prototype-builtins : 2
prefer-destructuring : 2
no-useless-escape : 2
no-loop-func : 2
prefer-rest-params : 2
default-param-last : 2
space-before-blocks : 2
no-param-reassign : 2
prefer-arrow-callback : 2
no-dupe-class-members : 2
class-methods-use-this : 2
no-duplicate-imports : 2
import/no-mutable-exports : 2
import/prefer-default-export : 2
import/first : 2
import/no-webpack-loader-syntax: 2
max-len :
- 2
- 80
- ignoreUrls: true
- ignoreStrings: true
no-loops/no-loops: 2
'@getify/proper-arrows/params':
- error
- allowed:
- _
- __
promise/prefer-await-to-callbacks: 2
no-secrets/no-secrets: 2
func-names:
- 2
- as-needed
unicorn/filename-case:
- 2
- cases:
camelCase: true
pascalCase: true
# ERROR ========================================================= ERROR
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment