Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit c3cad51

Browse files
golopotljharb
authored andcommittedSep 16, 2019
[eslint] increase severity of rules; eslint --quiet --fix
1 parent e5967f9 commit c3cad51

33 files changed

+105
-161
lines changed
 

‎.eslintrc.yml

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ rules:
2424
- 2
2525
- single
2626
- allowTemplateLiterals: true
27+
avoidEscape: true
2728

2829
# dog fooding
2930
import/no-extraneous-dependencies: "error"

‎config/.eslintrc.yml

-14
This file was deleted.

‎config/errors.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ module.exports = {
99
, 'import/named': 2
1010
, 'import/namespace': 2
1111
, 'import/default': 2
12-
, 'import/export': 2
13-
}
12+
, 'import/export': 2,
13+
},
1414
}

‎config/recommended.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ module.exports = {
1616
// red flags (thus, warnings)
1717
'import/no-named-as-default': 'warn',
1818
'import/no-named-as-default-member': 'warn',
19-
'import/no-duplicates': 'warn'
19+
'import/no-duplicates': 'warn',
2020
},
2121

2222
// need all these for parsing dependencies (even if _your_ code doesn't need

‎config/stage-0.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ module.exports = {
88
plugins: ['import'],
99
rules: {
1010
'import/no-deprecated': 1,
11-
}
11+
},
1212
}

‎config/typescript.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,20 @@
22
* Adds `.jsx`, `.ts` and `.tsx` as an extension, and enables JSX/TSX parsing.
33
*/
44

5-
var allExtensions = ['.ts', '.tsx', '.d.ts', '.js', '.jsx'];
5+
var allExtensions = ['.ts', '.tsx', '.d.ts', '.js', '.jsx']
66

77
module.exports = {
88

99
settings: {
1010
'import/extensions': allExtensions,
1111
'import/parsers': {
12-
'@typescript-eslint/parser': ['.ts', '.tsx', '.d.ts']
12+
'@typescript-eslint/parser': ['.ts', '.tsx', '.d.ts'],
1313
},
1414
'import/resolver': {
1515
'node': {
16-
'extensions': allExtensions
17-
}
18-
}
19-
}
16+
'extensions': allExtensions,
17+
},
18+
},
19+
},
2020

2121
}

‎memo-parser/.eslintrc.yml

-11
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,3 @@
11
---
22
rules:
3-
semi: [1, 'never']
4-
comma-dangle: [1, 'always-multiline']
5-
no-console: 1
6-
no-extra-semi: 1
7-
no-useless-escape: 1
8-
quotes:
9-
- 1
10-
- single
11-
- allowTemplateLiterals: true
12-
avoidEscape: true
13-
import/default: 1
143
import/no-extraneous-dependencies: 1

‎memo-parser/index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"use strict"
1+
'use strict'
22

33
const crypto = require('crypto')
44
, moduleRequire = require('eslint-module-utils/module-require').default
@@ -20,7 +20,7 @@ exports.parse = function parse(content, options) {
2020
options = Object.assign({}, options, parserOptions)
2121

2222
if (!options.filePath) {
23-
throw new Error("no file path provided!")
23+
throw new Error('no file path provided!')
2424
}
2525

2626
const keyHash = crypto.createHash('sha256')

‎resolvers/.eslintrc.yml

-13
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,3 @@
11
---
22
env:
33
es6: false
4-
rules:
5-
semi: [1, 'never']
6-
comma-dangle: [1, 'always-multiline']
7-
no-console: 1
8-
no-extra-semi: 1
9-
no-useless-escape: 1
10-
quotes:
11-
- 1
12-
- single
13-
- allowTemplateLiterals: true
14-
avoidEscape: true
15-
import/default: 1
16-
import/no-extraneous-dependencies: 1

‎resolvers/webpack/.eslintrc.yml

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
rules:
3+
import/no-extraneous-dependencies: 1
4+
no-console: 1

‎resolvers/webpack/test/config.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,8 @@ describe("config", function () {
119119
var settings = {
120120
config: require(path.join(__dirname, './files/webpack.function.config.js')),
121121
argv: {
122-
mode: 'test'
123-
}
122+
mode: 'test',
123+
},
124124
}
125125

126126
expect(resolve('baz', file, settings)).to.have.property('path')
@@ -130,7 +130,7 @@ describe("config", function () {
130130
it('passes a default empty argv object to config when it is a function', function() {
131131
var settings = {
132132
config: require(path.join(__dirname, './files/webpack.function.config.js')),
133-
argv: undefined
133+
argv: undefined,
134134
}
135135

136136
expect(function () { resolve('baz', file, settings) }).to.not.throw(Error)

‎resolvers/webpack/test/files/node_modules/webpack-resolver-plugin-test/index.js

+17-17
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎resolvers/webpack/test/files/webpack.config.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,18 @@ module.exports = {
2323
'bootstrap',
2424
function (context, request, callback) {
2525
if (request === 'underscore') {
26-
return callback(null, 'underscore');
27-
};
28-
callback();
29-
}
26+
return callback(null, 'underscore')
27+
}
28+
callback()
29+
},
3030
],
3131

3232
plugins: [
3333
new pluginsTest.ResolverPlugin([
3434
new pluginsTest.SimpleResolver(
3535
path.join(__dirname, 'some', 'bar', 'bar.js'),
3636
path.join(__dirname, 'some', 'bar')
37-
)
38-
])
39-
]
37+
),
38+
]),
39+
],
4040
}

‎tests/.eslintrc.yml

+1-13
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,5 @@ parserOptions:
44
env:
55
mocha: true
66
rules:
7-
no-unused-expressions: 0
87
max-len: 0
9-
semi: [1, 'never']
10-
comma-dangle: [1, 'always-multiline']
11-
no-console: 1
12-
no-extra-semi: 1
13-
no-useless-escape: 1
14-
quotes:
15-
- 1
16-
- single
17-
- allowTemplateLiterals: true
18-
avoidEscape: true
19-
import/default: 1
20-
import/no-extraneous-dependencies: 1
8+
import/default: 0

‎tests/src/core/importType.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,12 @@ describe('importType(name)', function () {
4343
})
4444

4545
it("should return 'internal' for non-builtins resolved outside of node_modules", function () {
46-
const pathContext = testContext({ "import/resolver": { node: { paths: [pathToTestFiles] } } })
46+
const pathContext = testContext({ 'import/resolver': { node: { paths: [pathToTestFiles] } } })
4747
expect(importType('importType', pathContext)).to.equal('internal')
4848
})
4949

5050
it.skip("should return 'internal' for scoped packages resolved outside of node_modules", function () {
51-
const pathContext = testContext({ "import/resolver": { node: { paths: [pathToTestFiles] } } })
51+
const pathContext = testContext({ 'import/resolver': { node: { paths: [pathToTestFiles] } } })
5252
expect(importType('@importType/index', pathContext)).to.equal('internal')
5353
})
5454

‎tests/src/core/resolve.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,8 @@ describe('resolve', function () {
111111
})
112112

113113
it('reports loaded resolver with invalid interface', function () {
114-
const resolverName = './foo-bar-resolver-invalid';
115-
const testContext = utils.testContext({ 'import/resolver': resolverName });
114+
const resolverName = './foo-bar-resolver-invalid'
115+
const testContext = utils.testContext({ 'import/resolver': resolverName })
116116
const testContextReports = []
117117
testContext.report = function (reportInfo) {
118118
testContextReports.push(reportInfo)

‎tests/src/rules/exports-last.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ const ruleTester = new RuleTester()
88
const error = type => ({
99
ruleId: 'exports-last',
1010
message: 'Export statements should appear at the end of the file',
11-
type
12-
});
11+
type,
12+
})
1313

1414
ruleTester.run('exports-last', rule, {
1515
valid: [

‎tests/src/rules/first.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ ruleTester.run('first', rule, {
2222
, errors: 1
2323
, output: "import { x } from './foo';\
2424
import { y } from './bar';\
25-
export { x };"
25+
export { x };",
2626
})
2727
, test({ code: "import { x } from './foo';\
2828
export { x };\
@@ -32,19 +32,19 @@ ruleTester.run('first', rule, {
3232
, output: "import { x } from './foo';\
3333
import { y } from './bar';\
3434
import { z } from './baz';\
35-
export { x };"
35+
export { x };",
3636
})
3737
, test({ code: "import { x } from './foo'; import { y } from 'bar'"
3838
, options: ['absolute-first']
39-
, errors: 1
39+
, errors: 1,
4040
})
4141
, test({ code: "import { x } from 'foo';\
4242
'use directive';\
4343
import { y } from 'bar';"
4444
, errors: 1
4545
, output: "import { x } from 'foo';\
4646
import { y } from 'bar';\
47-
'use directive';"
47+
'use directive';",
4848
})
4949
, test({ code: "var a = 1;\
5050
import { y } from './bar';\
@@ -56,12 +56,12 @@ ruleTester.run('first', rule, {
5656
var a = 1;\
5757
if (true) { x() };\
5858
import { x } from './foo';\
59-
import { z } from './baz';"
59+
import { z } from './baz';",
6060
})
6161
, test({ code: "if (true) { console.log(1) }import a from 'b'"
6262
, errors: 1
63-
, output: "import a from 'b'\nif (true) { console.log(1) }"
63+
, output: "import a from 'b'\nif (true) { console.log(1) }",
6464
})
6565
,
66-
]
66+
],
6767
})

‎tests/src/rules/named.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ ruleTester.run('named', rule, {
197197
test({
198198
code: 'import { baz } from "./broken-trampoline"',
199199
parser: require.resolve('babel-eslint'),
200-
errors: ["baz not found via broken-trampoline.js -> named-exports.js"],
200+
errors: ['baz not found via broken-trampoline.js -> named-exports.js'],
201201
}),
202202

203203
// parse errors

‎tests/src/rules/no-deprecated.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,16 @@ ruleTester.run('no-deprecated', rule, {
1515

1616
test({
1717
code: "import { fn } from './deprecated'",
18-
settings: { 'import/docstyle': ['tomdoc'] }
18+
settings: { 'import/docstyle': ['tomdoc'] },
1919
}),
2020

2121
test({
2222
code: "import { fine } from './tomdoc-deprecated'",
23-
settings: { 'import/docstyle': ['tomdoc'] }
23+
settings: { 'import/docstyle': ['tomdoc'] },
2424
}),
2525
test({
2626
code: "import { _undocumented } from './tomdoc-deprecated'",
27-
settings: { 'import/docstyle': ['tomdoc'] }
27+
settings: { 'import/docstyle': ['tomdoc'] },
2828
}),
2929

3030
// naked namespace is fine
@@ -70,7 +70,7 @@ ruleTester.run('no-deprecated', rule, {
7070
test({
7171
code: "import { fn } from './tomdoc-deprecated'",
7272
settings: { 'import/docstyle': ['tomdoc'] },
73-
errors: ["Deprecated: This function is terrible."],
73+
errors: ['Deprecated: This function is terrible.'],
7474
}),
7575

7676
test({

‎tests/src/rules/no-restricted-paths.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,14 @@ ruleTester.run('no-restricted-paths', rule, {
3737
filename: testFilePath('./restricted-paths/client/a.js'),
3838
options: [ {
3939
zones: [ { target: './tests/files/restricted-paths/client', from: './tests/files/restricted-paths/server' } ],
40-
} ], }),
40+
} ] }),
4141

4242
// no config
4343
test({ code: 'require("../server/b.js")' }),
4444
test({ code: 'import b from "../server/b.js"' }),
4545

4646
// builtin (ignore)
47-
test({ code: 'require("os")' })
47+
test({ code: 'require("os")' }),
4848
],
4949

5050
invalid: [

0 commit comments

Comments
 (0)
Please sign in to comment.