-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from kubeshop/mm/feat/reactrouter
feat: add eslint prettier react-router
- Loading branch information
Showing
13 changed files
with
480 additions
and
51 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# EditorConfig is awesome: https://EditorConfig.org | ||
|
||
# top-most EditorConfig file | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
end_of_line = lf | ||
max_line_length = 120 | ||
indent_size = 2 | ||
|
||
[*.{ts, tsx, js, json, css, html}] | ||
indent_style = space | ||
|
||
[*.md] | ||
max_line_length = 0 | ||
trim_trailing_whitespace = false | ||
|
||
[COMMIT_EDITMSG] | ||
max_line_length = 0 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
node_modules | ||
build | ||
cache | ||
lib | ||
dist | ||
.husky | ||
webpack.*.js | ||
server.js | ||
build.js | ||
init.js | ||
site |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
module.exports = { | ||
env: { | ||
browser: true, | ||
es2021: true, | ||
}, | ||
extends: ['plugin:react/recommended', 'airbnb', 'prettier'], | ||
parser: '@typescript-eslint/parser', | ||
parserOptions: { | ||
ecmaFeatures: {jsx: true}, | ||
ecmaVersion: 12, | ||
sourceType: 'module', | ||
}, | ||
plugins: ['react', '@typescript-eslint', 'react-hooks', 'unused-imports', 'prettier'], | ||
rules: { | ||
'no-underscore-dangle': 'off', | ||
'react/jsx-uses-react': 'off', | ||
'react/react-in-jsx-scope': 'off', | ||
'react-hooks/rules-of-hooks': 'error', // Checks rules of Hooks | ||
'react-hooks/exhaustive-deps': 'warn', // Checks effect dependencies | ||
'no-console': 'warn', | ||
'no-undef': 'off', | ||
semi: 'error', | ||
'no-unused-vars': 'off', | ||
'@typescript-eslint/no-unused-vars': ['warn'], | ||
'import/no-extraneous-dependencies': 'off', | ||
'prefer-destructuring': 'off', | ||
'no-param-reassign': 'off', | ||
'no-use-before-define': 'off', | ||
'comma-dangle': 'off', | ||
'no-multiple-empty-lines': 1, | ||
'no-useless-escape': 'off', | ||
'object-curly-newline': 'off', | ||
'lines-between-class-members': 'off', | ||
'unused-imports/no-unused-imports-ts': 'error', | ||
'react/jsx-props-no-spreading': 0, | ||
'react/jsx-max-props-per-line': [1, {maximum: 1, when: 'multiline'}], | ||
// Disabled old no-shadow rule as seems to be communicated by ESLint while working with TS. | ||
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-shadow.md | ||
'no-shadow': 'off', | ||
'@typescript-eslint/no-shadow': ['error'], | ||
'import/prefer-default-export': 'off', // cannot control what we import from standard libs | ||
'import/no-unresolved': 'off', // typescript | ||
'require-yield': 'off', // don't micromanage sagas or side effects | ||
'import/extensions': 'off', // don't micromanage pretty imports | ||
'no-unused-expressions': 'off', // prevents basic use of React exports such as in App.tsx | ||
'react/jsx-filename-extension': [2, {extensions: ['.js', '.jsx', '.ts', '.tsx']}], // Make ESLint happy about JSX inside of tsx files | ||
// Temporarily, we will ignore these while we introduce linting to our repo *conservatively*. | ||
// These are to be re-enabled soon. | ||
'arrow-body-style': 'off', // warn | ||
'arrow-parens': 'off', // warn | ||
'dot-notation': 'off', // required for our env variables currently | ||
'prefer-const': 'off', | ||
'max-len': 'off', | ||
'react/jsx-no-target-blank': 'off', // target="_blank" without rel="noreferrer" is a security risk: see https://html.spec.whatwg.org/multipage/links.html#link-type-noopener react/jsx-no-target-blank | ||
'react/prop-types': 'off', // TODO re-enable | ||
'react/require-default-props': 'off', // TODO re-enable | ||
'no-nested-ternary': 'off', // warn | ||
'consistent-return': 'off', // warn. Look at api calls closely before enabling this. api.ts. | ||
// Accessibility off for now to make speed a priority and avoid restructuring for now | ||
'jsx-a11y/click-events-have-key-events': 'off', | ||
'jsx-a11y/no-static-element-interactions': 'off', | ||
'jsx-a11y/anchor-is-valid': 'off', // TODO warn because, we should really be using buttons. | ||
'jsx-a11y/no-noninteractive-element-interactions': 'off', | ||
'jsx-a11y/alt-text': 'off', | ||
'space-in-brackets': 'off', | ||
'jsx-a11y/label-has-associated-control': [ | ||
'warn', | ||
{ | ||
controlComponents: ['Select'], | ||
assert: 'either', | ||
depth: 3, | ||
}, | ||
], | ||
'no-implicit-coercion': [ | ||
'error', | ||
{ | ||
boolean: true, | ||
number: true, | ||
string: true, | ||
}, | ||
], | ||
'react/function-component-definition': [ | ||
2, | ||
{ | ||
namedComponents: "function-declaration", | ||
unnamedComponents: "arrow-function", | ||
}, | ||
], | ||
}, | ||
ignorePatterns: ['package.json', './node_modules', './dist', '**/dist/*.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
.idea | ||
.git | ||
build | ||
dist | ||
.husky | ||
node_modules |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"importOrderSeparation": true, | ||
"importOrderSortSpecifiers": true, | ||
"singleQuote": true, | ||
"arrowParens": "avoid", | ||
"bracketSpacing": false, | ||
"semi": true, | ||
"trailingComma": "es5", | ||
"printWidth": 120, | ||
"jsxBracketSameLine": false, | ||
"proseWrap": "always", | ||
"quoteProps": "as-needed", | ||
"tabWidth": 2, | ||
"useTabs": false | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.