Skip to content

Commit 63d367e

Browse files
authored
refactor: move eslint config to type overrides (#725)
1 parent 77e9a6c commit 63d367e

File tree

5 files changed

+51
-42
lines changed

5 files changed

+51
-42
lines changed

.eslintignore

-3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,3 @@ dist
66

77
# Website directory
88
website
9-
10-
# eslint cannot lint itself
11-
.eslintrc.js

.eslintrc.js

+49-37
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,58 @@
11
module.exports = {
2-
extends: [
3-
'eslint:recommended',
4-
'plugin:prettier/recommended',
5-
'plugin:@typescript-eslint/recommended',
6-
'plugin:@typescript-eslint/recommended-requiring-type-checking',
7-
'prettier/@typescript-eslint',
8-
],
2+
extends: ['eslint:recommended', 'plugin:prettier/recommended'],
93
env: {
10-
browser: true,
11-
amd: true,
4+
es6: true,
125
node: true,
13-
mocha: true,
146
},
15-
parser: '@typescript-eslint/parser',
167
parserOptions: {
17-
ecmaVersion: 6,
188
sourceType: 'module',
19-
project: './tsconfig.lint.json',
20-
warnOnUnsupportedTypeScriptVersion: false,
219
},
22-
plugins: ['@typescript-eslint'],
23-
rules: {
24-
'arrow-body-style': ['error'],
25-
'no-template-curly-in-string': 'error',
26-
'no-useless-concat': 'error',
27-
'no-useless-escape': 'off',
28-
'no-var': 'error',
29-
'one-var': ['error', 'never'],
30-
'prefer-arrow-callback': ['error', { allowNamedFunctions: true }],
31-
'prefer-const': 'error',
32-
'prefer-template': 'error',
33-
quotes: ['error', 'single', { avoidEscape: true }],
34-
'template-curly-spacing': 'error',
35-
'template-tag-spacing': 'error',
10+
overrides: [
11+
{
12+
files: ['**/*.ts'],
13+
extends: [
14+
'eslint:recommended',
15+
'plugin:@typescript-eslint/recommended',
16+
'plugin:@typescript-eslint/recommended-requiring-type-checking',
17+
'plugin:prettier/recommended',
18+
],
19+
parser: '@typescript-eslint/parser',
20+
parserOptions: {
21+
ecmaVersion: 6,
22+
sourceType: 'module',
23+
project: './tsconfig.lint.json',
24+
warnOnUnsupportedTypeScriptVersion: false,
25+
},
26+
plugins: ['@typescript-eslint'],
27+
rules: {
28+
'arrow-body-style': ['error'],
29+
'no-template-curly-in-string': 'error',
30+
'no-useless-concat': 'error',
31+
'no-useless-escape': 'off',
32+
'no-var': 'error',
33+
'one-var': ['error', 'never'],
34+
'prefer-arrow-callback': ['error', { allowNamedFunctions: true }],
35+
'prefer-const': 'error',
36+
'prefer-template': 'error',
37+
'template-curly-spacing': 'error',
38+
'template-tag-spacing': 'error',
39+
quotes: ['error', 'single', { avoidEscape: true }],
3640

37-
'@typescript-eslint/adjacent-overload-signatures': 'off',
38-
'@typescript-eslint/ban-ts-comment': 'off',
39-
'@typescript-eslint/no-unsafe-assignment': 'off',
40-
'@typescript-eslint/no-unsafe-call': 'off',
41-
'@typescript-eslint/no-unsafe-member-access': 'off',
42-
'@typescript-eslint/no-unused-vars': 'off',
43-
'@typescript-eslint/no-var-requires': 'off',
44-
'@typescript-eslint/restrict-template-expressions': 'off',
45-
},
41+
'@typescript-eslint/adjacent-overload-signatures': 'off',
42+
'@typescript-eslint/ban-ts-comment': 'off',
43+
'@typescript-eslint/no-unsafe-assignment': 'off',
44+
'@typescript-eslint/no-unsafe-call': 'off',
45+
'@typescript-eslint/no-unsafe-member-access': 'off',
46+
'@typescript-eslint/no-unused-vars': 'off',
47+
'@typescript-eslint/no-var-requires': 'off',
48+
'@typescript-eslint/restrict-template-expressions': 'off',
49+
},
50+
},
51+
{
52+
files: ['**/*.spec.js'],
53+
env: {
54+
mocha: true,
55+
},
56+
},
57+
],
4658
}

.prettierignore

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ npm-debug.log*
1818
.github/PULL_REQUEST_TEMPLATE.md
1919

2020
/website/playground
21+
/website/build
2122
/website/.docusaurus
2223
/website/plugins
2324
/website/static

parser-preset.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module.exports = {
22
parserOpts: {
3-
headerPattern: /^(\w*)\((\w*)\)\:\s(.*)$/,
3+
headerPattern: /^(\w*)\((\w*)\):\s(.*)$/,
44
headerCorrespondence: ['type', 'scope', 'subject'],
55
},
66
}

test/cli/formatters/junit.spec.js

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
const expect = require('expect.js')
22

33
const ChildProcess = require('child_process')
4-
const fs = require('fs')
54
const path = require('path')
65

76
describe('CLI', () => {

0 commit comments

Comments
 (0)