Skip to content

Commit 1408729

Browse files
committed
tech: plug in eslint and prettier
1 parent 2eb55c2 commit 1408729

18 files changed

+1158
-387
lines changed

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules

.eslintrc.js

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
module.exports = {
2+
root: true,
3+
parser: '@typescript-eslint/parser',
4+
plugins: [
5+
'simple-import-sort',
6+
'@typescript-eslint',
7+
'prettier',
8+
'react',
9+
'react-hooks'
10+
],
11+
parserOptions: {
12+
ecmaVersion: 2020,
13+
sourceType: 'module',
14+
ecmaFeatures: {
15+
jsx: true
16+
}
17+
},
18+
settings: {
19+
react: {
20+
version: 'detect'
21+
}
22+
},
23+
env: {
24+
browser: true,
25+
amd: true,
26+
node: true
27+
},
28+
extends: [
29+
'eslint:recommended',
30+
'plugin:@typescript-eslint/eslint-recommended',
31+
'plugin:@typescript-eslint/recommended',
32+
'plugin:react/recommended',
33+
'plugin:jsx-a11y/recommended',
34+
'plugin:prettier/recommended' // Make sure this is always the last element in the array.
35+
],
36+
rules: {
37+
'prettier/prettier': ['error', {}, { usePrettierrc: true }],
38+
'react/react-in-jsx-scope': 'off',
39+
'react/prop-types': 'off',
40+
'@typescript-eslint/explicit-function-return-type': 'off',
41+
'simple-import-sort/imports': 'error',
42+
'jsx-a11y/anchor-is-valid': [
43+
'error',
44+
{
45+
components: ['Link'],
46+
specialLink: ['hrefLeft', 'hrefRight'],
47+
aspects: ['invalidHref', 'preferButton']
48+
}
49+
]
50+
}
51+
};

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules

.prettierrc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"printWidth": 120,
3+
"singleQuote": true,
4+
"trailingComma": "all",
5+
"semi": true
6+
}

.vscode/settings.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"[typescript]": {
3+
"editor.tabSize": 2
4+
},
5+
"editor.codeActionsOnSave": {
6+
"source.fixAll.eslint": true
7+
},
8+
"eslint.validate": ["typescript"]
9+
}

0 commit comments

Comments
 (0)