Skip to content

Commit 813a116

Browse files
authored
Merge pull request #1475 from golopot/eslint
[eslint] make CI lint tests, utils, resolvers, ...etc
2 parents 2e047e6 + c3cad51 commit 813a116

39 files changed

+417
-114
lines changed

.eslintignore

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
lib
2+
coverage
3+
.nyc_output
4+
node_modules
5+
tests/files/malformed.js
6+
tests/files/with-syntax-error
7+
resolvers/webpack/test/files
8+
# we want to ignore "tests/files" here, but unfortunately doing so would
9+
# interfere with unit test and fail it for some reason.
10+
# tests/files

.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/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

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
rules:
3+
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')

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"prebuild": "rimraf lib",
2020
"watch": "npm run mocha -- --watch tests/src",
2121
"pretest": "linklocal",
22-
"posttest": "eslint ./src",
22+
"posttest": "eslint .",
2323
"mocha": "cross-env BABEL_ENV=test NODE_PATH=./src nyc -s mocha -R dot --recursive -t 5s",
2424
"test": "npm run mocha tests/src",
2525
"test-compiled": "npm run prepublish && NODE_PATH=./lib mocha --compilers js:babel-register --recursive tests/src",
File renamed without changes.

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
}

src/.eslintrc src/.eslintrc.yml

File renamed without changes.

tests/.eslintrc

-6
This file was deleted.

tests/.eslintrc.yml

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
parserOptions:
3+
ecmaVersion: 8
4+
env:
5+
mocha: true
6+
rules:
7+
max-len: 0
8+
import/default: 0

0 commit comments

Comments
 (0)