-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
EPMGCIP-179: Configure linters #31
Changes from 10 commits
a563a1b
65db864
6bde603
8829cac
0e5b7f1
cad5d82
7d4e5d4
857bc52
1fbcba9
99eef80
4aed9dd
ac08edb
552bd71
690ccef
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,126 @@ | ||
{ | ||
"extends": ["next/core-web-vitals", "prettier"], | ||
"root": true, | ||
"extends": [ | ||
"next/core-web-vitals", | ||
"eslint:recommended", | ||
"plugin:prettier/recommended", | ||
"plugin:@typescript-eslint/recommended" | ||
], | ||
"ignorePatterns": ["node_modules", "src/__generated__", "build", "coverage"], | ||
"parser": "@typescript-eslint/parser", | ||
"parserOptions": { | ||
"ecmaVersion": "latest", | ||
"project": "./tsconfig.json", | ||
"ecmaFeatures": { | ||
"jsx": true | ||
} | ||
}, | ||
"plugins": ["@typescript-eslint", "eslint-plugin-import", "unused-imports", "import"], | ||
"rules": { | ||
"@next/next/no-img-element": 0 | ||
"@next/next/no-img-element": "off", | ||
"@typescript-eslint/array-type": [ | ||
"error", | ||
{ | ||
"default": "array-simple" | ||
} | ||
], | ||
"@typescript-eslint/consistent-return": "warn", | ||
"@typescript-eslint/no-empty-function": [ | ||
"warn", | ||
{ | ||
"allow": ["arrowFunctions"] | ||
} | ||
], | ||
"@typescript-eslint/no-explicit-any": "warn", | ||
"@typescript-eslint/no-implied-eval": "error", | ||
"@typescript-eslint/no-mixed-enums": "error", | ||
"@typescript-eslint/no-useless-constructor": "error", | ||
"@typescript-eslint/only-throw-error": "error", | ||
"@typescript-eslint/prefer-enum-initializers": "warn", | ||
"@typescript-eslint/prefer-for-of": "error", | ||
"@typescript-eslint/return-await": "error", | ||
"@typescript-eslint/unified-signatures": "error", | ||
"complexity": [ | ||
"warn", | ||
{ | ||
"max": 5 | ||
} | ||
], | ||
"consistent-return": "off", | ||
"import/no-unresolved": "error", | ||
"import/order": [ | ||
"error", | ||
{ | ||
"alphabetize": { | ||
"order": "asc", | ||
"caseInsensitive": true | ||
}, | ||
"groups": ["external", "internal"], | ||
"newlines-between": "always", | ||
"pathGroups": [ | ||
{ | ||
"pattern": "react", | ||
"group": "external", | ||
"position": "before" | ||
}, | ||
{ | ||
"pattern": "@/**", | ||
"group": "internal", | ||
"position": "after" | ||
} | ||
], | ||
"pathGroupsExcludedImportTypes": ["react"] | ||
} | ||
], | ||
"max-depth": ["warn", 1], | ||
Dzmitry-Yaniuk marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"max-lines": ["warn", 200], | ||
"max-nested-callbacks": ["warn", 3], | ||
"max-params": ["warn", 3], | ||
"max-statements-per-line": [ | ||
"warn", | ||
{ | ||
"max": 1 | ||
} | ||
], | ||
"newline-before-return": "error", | ||
"no-case-declarations": "warn", | ||
"no-else-return": "error", | ||
"no-magic-numbers": [ | ||
"warn", | ||
{ | ||
"detectObjects": false, | ||
"enforceConst": true, | ||
"ignore": [-1, 0, 1, 2, 10, 100], | ||
"ignoreArrayIndexes": true | ||
} | ||
], | ||
"no-multiple-empty-lines": [ | ||
"error", | ||
{ | ||
"max": 1, | ||
"maxEOF": 1 | ||
} | ||
], | ||
"no-nested-ternary": "error", | ||
"no-return-await": "off", | ||
"no-throw-literal": "off", | ||
"no-unneeded-ternary": "error", | ||
"no-warning-comments": "warn", | ||
"one-var-declaration-per-line": ["warn", "always"], | ||
"react/display-name": "warn", | ||
"react/sort-comp": "warn", | ||
"sort-keys": "warn", | ||
"unused-imports/no-unused-imports": "error" | ||
}, | ||
"settings": { | ||
"import/parsers": { | ||
"@typescript-eslint/parser": [".ts", ".tsx"] | ||
}, | ||
"import/resolver": { | ||
"typescript": { | ||
"alwaysTryTypes": true, | ||
"project": "./tsconfig.json" | ||
} | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,3 +37,12 @@ yarn-error.log* | |
next-env.d.ts | ||
|
||
.vercel | ||
|
||
# JetBrains IDE | ||
/.idea | ||
|
||
# VS Code | ||
/.vscode | ||
|
||
# VS | ||
/.vs |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Ignore 3rd party dependencies | ||
node_modules/ | ||
|
||
# Ignore generated code | ||
src/__generated__/ | ||
|
||
# Ignore artifacts: | ||
build | ||
coverage |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
{ | ||
"printWidth": 100, | ||
"semi": true, | ||
"singleQuote": true, | ||
"tabWidth": 2, | ||
"semi": true | ||
"trailingComma": "all" | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,6 @@ | ||
const config = { | ||
'*.{js,jsx,ts,tsx}':[ | ||
'eslint --fix --max-warnings 0', | ||
'prettier --write' | ||
], | ||
'*.{js,jsx,ts,tsx}': ['eslint --fix --max-warnings 30', 'prettier --write'], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Dzmitry-Yaniuk There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good idea! From my opinion absence of warnings in code is a project good shape indicator. Otherwise code cannot be pushed without bypass option for git commit. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Totally agree, so let's set the lowest available number for now and I will create additional ticket for reaching 0 |
||
'*.{json,scss,css}': ['prettier --write'], | ||
} | ||
}; | ||
|
||
export default config; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Previously we also used this plugins:
'plugin:jest/recommended',
'plugin:react-hooks/recommended',
'airbnb',
'airbnb/hooks',
'airbnb-typescript'
Maybe there is a sense to add them as well. What do you think about that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since there are existing
eslint:recommended
andprettier
plugins I assumeairbnb
related plugins might be a little redundant (quite rules in common). What do you think?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree