Skip to content
This repository was archived by the owner on Dec 24, 2022. It is now read-only.

Commit 8ef2b60

Browse files
eslint, prettier, husky installed
1 parent 62f4b87 commit 8ef2b60

File tree

7 files changed

+3427
-585
lines changed

7 files changed

+3427
-585
lines changed

.eslintignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
node_modules/*
2+
./node_modules/**
3+
**/node_modules/**
4+
build/*
5+
./build/**
6+
**/build/**
7+
.eslintcache

.eslintrc.js

Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
const fs = require('fs');
2+
const path = require('path');
3+
4+
const prettierOptions = JSON.parse(fs.readFileSync(path.resolve(__dirname, '.prettierrc'), 'utf8'));
5+
6+
module.exports = {
7+
parser: '@babel/eslint-parser',
8+
extends: [
9+
'airbnb',
10+
'prettier',
11+
'plugin:react-hooks/recommended',
12+
'plugin:react/recommended',
13+
'plugin:prettier/recommended',
14+
'plugin:import/errors',
15+
'plugin:import/warnings',
16+
],
17+
plugins: ['prettier', 'react', 'react-hooks', 'jsx-a11y'],
18+
env: {
19+
jest: true,
20+
browser: true,
21+
node: true,
22+
es6: true,
23+
},
24+
parserOptions: {
25+
ecmaVersion: 8,
26+
requireConfigFile: false,
27+
sourceType: 'module',
28+
ecmaFeatures: {
29+
jsx: true,
30+
},
31+
babelOptions: {
32+
presets: ['@babel/preset-react'],
33+
},
34+
},
35+
rules: {
36+
'prettier/prettier': ['error', prettierOptions],
37+
'arrow-body-style': [2, 'as-needed'],
38+
'class-methods-use-this': 0,
39+
'import/imports-first': 0,
40+
'import/newline-after-import': 0,
41+
'import/no-dynamic-require': 0,
42+
'import/no-extraneous-dependencies': ['error', { devDependencies: true }],
43+
'react/jsx-props-no-spreading': 'off',
44+
'import/no-named-as-default': 0,
45+
'import/no-webpack-loader-syntax': 0,
46+
'import/prefer-default-export': 0,
47+
// allow paren-less arrow functions
48+
'arrow-parens': process.env.NODE_ENV === 'production' ? 2 : 0,
49+
// allow debugger during development
50+
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
51+
'jsx-a11y/aria-props': 2,
52+
'jsx-a11y/heading-has-content': 0,
53+
'jsx-a11y/label-has-associated-control': [
54+
2,
55+
{
56+
// NOTE: If this error triggers, either disable it or add
57+
// your custom components, labels and attributes via these options
58+
// See https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/label-has-associated-control.md
59+
controlComponents: ['Input'],
60+
},
61+
],
62+
'jsx-a11y/label-has-for': 0,
63+
'jsx-a11y/mouse-events-have-key-events': 2,
64+
'jsx-a11y/role-has-required-aria-props': 2,
65+
'jsx-a11y/role-supports-aria-props': 2,
66+
'max-len': 0,
67+
'import/order': [
68+
'error',
69+
{
70+
'newlines-between': 'never',
71+
groups: [
72+
['builtin', 'external'],
73+
['internal', 'parent', 'sibling', 'index', 'unknown'],
74+
],
75+
},
76+
],
77+
'newline-per-chained-call': 0,
78+
'no-confusing-arrow': 0,
79+
'no-console': 0,
80+
'no-unused-vars': 2,
81+
'no-multiple-empty-lines': 2,
82+
'no-use-before-define': 0,
83+
'prefer-template': 2,
84+
'react/destructuring-assignment': 2,
85+
'react-hooks/rules-of-hooks': 'error',
86+
'react/jsx-closing-tag-location': 2,
87+
'react/forbid-prop-types': 0,
88+
'react/jsx-first-prop-new-line': [2, 'multiline'],
89+
'react/jsx-no-target-blank': 0,
90+
'react/jsx-uses-vars': 2,
91+
'react/require-default-props': 0,
92+
'react/require-extension': 0,
93+
'react/self-closing-comp': 0,
94+
'react/sort-comp': 0,
95+
'require-yield': 0,
96+
'import/no-unresolved': [2, { caseSensitive: false }],
97+
// suppress errors for missing 'import React' in files
98+
'react/react-in-jsx-scope': 'off',
99+
// allow jsx syntax in js files (for next.js project)
100+
'react/jsx-filename-extension': [1, { extensions: ['.js', '.jsx'] }], // should add ".ts" if typescript project
101+
'react/function-component-definition': [
102+
2,
103+
{
104+
namedComponents: 'function-declaration',
105+
},
106+
],
107+
'no-param-reassign': 0,
108+
'react/jsx-no-bind': [
109+
2,
110+
{
111+
ignoreDOMComponents: true,
112+
ignoreRefs: true,
113+
allowArrowFunctions: true,
114+
allowFunctions: true,
115+
allowBind: true,
116+
},
117+
],
118+
'no-underscore-dangle': 0,
119+
// camelcase off only for this project, from backend they have used many underscore variable
120+
camelcase: 0,
121+
'import/no-cycle': 0,
122+
'no-constructor-return': 0,
123+
'react/button-has-type': 2,
124+
'react/no-adjacent-inline-elements': 2,
125+
'react/no-array-index-key': 2,
126+
'react/no-arrow-function-lifecycle': 2,
127+
'react/no-invalid-html-attribute': 2,
128+
'react/no-multi-comp': 2,
129+
'react/no-typos': 2,
130+
'react/no-unstable-nested-components': 2,
131+
'react/no-unused-prop-types': 2,
132+
'react/no-unused-state': 2,
133+
'react/prefer-exact-props': 2,
134+
'react/jsx-child-element-spacing': 2,
135+
'react/jsx-closing-bracket-location': 2,
136+
'no-duplicate-imports': 2,
137+
'no-unreachable-loop': 2,
138+
'block-scoped-var': 2,
139+
'default-case': 2,
140+
'default-case-last': 2,
141+
'default-param-last': 2,
142+
'dot-notation': 2,
143+
'react/prop-types': 2,
144+
'prefer-const': 1,
145+
'react/display-name': 0,
146+
},
147+
settings: {
148+
'import/resolver': {
149+
node: {
150+
extensions: ['.js', '.jsx', '.ts', '.tsx'],
151+
moduleDirectory: ['node_modules', 'src/'],
152+
},
153+
},
154+
},
155+
};

.prettierignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
build/
2+
node_modules/
3+
package-lock.json
4+
yarn.lock
5+
package.json
6+
.eslintcache
7+
coverage

.prettierrc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"trailingComma": "es5",
3+
"tabWidth": 4,
4+
"useTabs": true,
5+
"semi": true,
6+
"singleQuote": true,
7+
"proseWrap": "always",
8+
"bracketSpacing": true,
9+
"printWidth": 100
10+
}

jsconfig.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"compilerOptions": {
3+
"baseUrl": "src"
4+
},
5+
"include": ["src"],
6+
"strict": true,
7+
"forceConsistentCasingInFileNames": true
8+
}

0 commit comments

Comments
 (0)