Skip to content

Commit 579712f

Browse files
committed
Update README and strip prettier configuration (for now)
1 parent e3c9bd2 commit 579712f

18 files changed

+579
-118
lines changed

README.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,56 @@
11
# eslint-config-typescript
22
An opinionated set of ESLint rules for TypeScript projects
3+
4+
## Installation
5+
Install eslint-config-typescript:
6+
7+
```bash
8+
$ npm install --save-dev eslint-config-typescript
9+
```
10+
11+
Then, add eslint-config-typescript to the "extends" array in your ESLint file.
12+
Make sure to put it last, so it gets the chance to override other configs.
13+
14+
```json
15+
{
16+
"extends": [
17+
"typescript"
18+
]
19+
}
20+
```
21+
22+
A few ESLint plugins are supported as well:
23+
```json
24+
{
25+
"extends": [
26+
"typescript",
27+
"typescript/react",
28+
"typescript/prettier"
29+
]
30+
}
31+
```
32+
33+
## Example configuration
34+
```json
35+
{
36+
"extends": [
37+
"typescript",
38+
"typescript/react",
39+
"typescript/prettier"
40+
],
41+
"plugins": [
42+
"typescript"
43+
],
44+
"parserOptions": {
45+
"ecmaVersion": 2016,
46+
"sourceType": "module",
47+
"ecmaFeatures": {
48+
"jsx": true
49+
}
50+
},
51+
"env": {
52+
"es6": true,
53+
"node": true
54+
}
55+
}
56+
```

eslint.config.js

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,17 @@
1111
module.exports = {
1212
extends: ['eslint:recommended', 'prettier'],
1313
plugins: ['prettier', 'filenames'],
14+
parserOptions: {
15+
sourceType: 'module',
16+
ecmaVersion: 2015,
17+
ecmaFeatures: {
18+
jsx: true
19+
}
20+
},
1421
env: {
1522
es6: true,
1623
node: true,
17-
jest: true,
24+
jest: true
1825
},
1926
rules: {
2027
semi: 'error',
@@ -24,20 +31,20 @@ module.exports = {
2431
'no-console': [
2532
'error',
2633
{
27-
allow: ['warn', 'error'],
28-
},
34+
allow: ['warn', 'error']
35+
}
2936
],
3037
'valid-jsdoc': [
3138
'error',
3239
{
3340
preferType: {
3441
any: '*',
35-
object: 'Object',
42+
object: 'Object'
3643
},
3744
requireReturnType: true,
3845
requireParamDescription: true,
39-
requireReturnDescription: true,
40-
},
46+
requireReturnDescription: true
47+
}
4148
],
4249
quotes: ['error', 'single', { avoidEscape: true }],
4350
'jsx-quotes': ['error', 'prefer-single'],
@@ -51,8 +58,8 @@ module.exports = {
5158
bracketSpacing: true,
5259
jsxBracketSameLine: true,
5360
printWidth: 80,
54-
parser: 'typescript',
55-
},
56-
],
57-
},
61+
parser: 'typescript'
62+
}
63+
]
64+
}
5865
};

jest.config.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,19 @@ module.exports = {
1212
moduleFileExtensions: ['js', 'jsx', 'ts', 'tsx'],
1313
testMatch: [
1414
'<rootDir>/specs/*[.-][Ss]pec[s]?.{j,t}s{,x}',
15-
'<rootDir>/specs/**/*[.-][Ss]pec[s]?.{j,t}s{,x}',
15+
'<rootDir>/specs/**/*[.-][Ss]pec[s]?.{j,t}s{,x}'
1616
],
1717
rootDir: '.',
1818
verbose: false,
1919
resetMocks: true,
2020
resetModules: true,
2121
collectCoverage: false,
2222
collectCoverageFrom: [
23-
'**/*.{j,t}s{,x}',
23+
'{index,prettier,react}.{j,t}s{,x}',
24+
'src/*.{j,t}s{,x}',
2425
'!**/*.min.js',
2526
'!**/static/**',
2627
'!**/specs/**',
27-
'!**/node_modules/**',
28-
],
28+
'!**/node_modules/**'
29+
]
2930
};

0 commit comments

Comments
 (0)