eslint-config-uphold 1.0.1 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +28 -0
- package/README.md +8 -0
- package/package.json +18 -13
- package/src/index.js +28 -41
- package/src/rules/explicit-sinon-use-fake-timers.js +50 -0
- package/.travis.yml +0 -12
- package/test/fixtures/correct.js +0 -210
- package/test/fixtures/incorrect.js +0 -184
- package/test/index.js +0 -60
- package/yarn.lock +0 -1293
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,33 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [2.3.0](https://github.com/uphold/eslint-config-uphold/releases/tag/2.3.0) (2022-02-21)
|
|
4
|
+
- Enable array-callback-return rule [\#52](https://github.com/uphold/eslint-config-uphold/pull/52) ([satazor](https://github.com/satazor))
|
|
5
|
+
- Bump minimum node version to 12.22 [\#51](https://github.com/uphold/eslint-config-uphold/pull/51) ([diogotorres97](https://github.com/diogotorres97))
|
|
6
|
+
|
|
7
|
+
## [2.2.0](https://github.com/uphold/eslint-config-uphold/releases/tag/2.2.0) (2022-02-11)
|
|
8
|
+
- Update `no-irregular-whitespace` rule [\#50](https://github.com/uphold/eslint-config-uphold/pull/50) ([Americas](https://github.com/Americas))
|
|
9
|
+
- Release v2.1.0 [\#49](https://github.com/uphold/eslint-config-uphold/pull/49) ([Finglas](https://github.com/Finglas))
|
|
10
|
+
|
|
11
|
+
## [2.1.0](https://github.com/uphold/eslint-config-uphold/releases/tag/2.1.0) (2022-02-03)
|
|
12
|
+
- Upgrade github-changelog-generator to version 3.0.0 [\#48](https://github.com/uphold/eslint-config-uphold/pull/48) ([Finglas](https://github.com/Finglas))
|
|
13
|
+
- Replace travis with github actions [\#45](https://github.com/uphold/eslint-config-uphold/pull/45) ([diogotorres97](https://github.com/diogotorres97))
|
|
14
|
+
- Set eslint version to allow patch upgrades [\#46](https://github.com/uphold/eslint-config-uphold/pull/46) ([Finglas](https://github.com/Finglas))
|
|
15
|
+
- Update to use `eslint-parser` [\#44](https://github.com/uphold/eslint-config-uphold/pull/44) ([Finglas](https://github.com/Finglas))
|
|
16
|
+
- Bump y18n from 4.0.0 to 4.0.1 [\#38](https://github.com/uphold/eslint-config-uphold/pull/38) ([dependabot](https://github.com/apps/dependabot))
|
|
17
|
+
|
|
18
|
+
## [v2.0.0](https://github.com/uphold/eslint-config-uphold/releases/tag/v2.0.0) (2021-01-29)
|
|
19
|
+
- Add `files` property to package.json [\#37](https://github.com/uphold/eslint-config-uphold/pull/37) ([Americas](https://github.com/Americas))
|
|
20
|
+
- Bump prettier@2.2.1 [\#36](https://github.com/uphold/eslint-config-uphold/pull/36) ([Americas](https://github.com/Americas))
|
|
21
|
+
- Bump eslint@7.18.0 [\#35](https://github.com/uphold/eslint-config-uphold/pull/35) ([Americas](https://github.com/Americas))
|
|
22
|
+
- Bump ini from 1.3.5 to 1.3.7 [\#32](https://github.com/uphold/eslint-config-uphold/pull/32) ([dependabot[bot]](https://github.com/apps/dependabot))
|
|
23
|
+
- Bump node-fetch from 2.6.0 to 2.6.1 [\#31](https://github.com/uphold/eslint-config-uphold/pull/31) ([dependabot[bot]](https://github.com/apps/dependabot))
|
|
24
|
+
- Bump lodash from 4.17.15 to 4.17.20 [\#34](https://github.com/uphold/eslint-config-uphold/pull/34) ([dependabot[bot]](https://github.com/apps/dependabot))
|
|
25
|
+
- Add `explicit-sinon-use-fake-timers` rule [\#30](https://github.com/uphold/eslint-config-uphold/pull/30) ([nunofgs](https://github.com/nunofgs))
|
|
26
|
+
- Bump dependencies to fix security vulnerabilities [\#28](https://github.com/uphold/eslint-config-uphold/pull/28) ([waldyrious](https://github.com/waldyrious))
|
|
27
|
+
- Bump eslint-utils from 1.3.1 to 1.4.3 [\#25](https://github.com/uphold/eslint-config-uphold/pull/25) ([dependabot[bot]](https://github.com/apps/dependabot))
|
|
28
|
+
- Bump acorn from 6.2.0 to 6.4.1 [\#26](https://github.com/uphold/eslint-config-uphold/pull/26) ([dependabot[bot]](https://github.com/apps/dependabot))
|
|
29
|
+
- Bump https-proxy-agent from 2.2.2 to 2.2.4 [\#27](https://github.com/uphold/eslint-config-uphold/pull/27) ([dependabot[bot]](https://github.com/apps/dependabot))
|
|
30
|
+
|
|
3
31
|
## [v1.0.1](https://github.com/uphold/eslint-config-uphold/releases/tag/v1.0.1) (2019-10-11)
|
|
4
32
|
- Update @uphold/github-changelog-generator@1.0.1 [\#24](https://github.com/uphold/eslint-config-uphold/pull/24) ([rplopes](https://github.com/rplopes))
|
|
5
33
|
- Update @uphold/github-changelog-generator@1.0.0 [\#23](https://github.com/uphold/eslint-config-uphold/pull/23) ([rplopes](https://github.com/rplopes))
|
package/README.md
CHANGED
|
@@ -42,3 +42,11 @@ To automatically fix all lint issues, use the `--fix` option:
|
|
|
42
42
|
```sh
|
|
43
43
|
$ npm run lint --fix
|
|
44
44
|
```
|
|
45
|
+
|
|
46
|
+
## Upgrading eslint
|
|
47
|
+
|
|
48
|
+
See the [eslint repo](https://github.com/eslint/eslint#semantic-versioning-policy) for eslint's guidelines on semantic versioning.
|
|
49
|
+
|
|
50
|
+
A [tilde range](https://docs.npmjs.com/cli/v6/using-npm/semver#tilde-ranges-123-12-1) is set for the eslint dependency to pick up any patch changes by default.
|
|
51
|
+
|
|
52
|
+
For any minor/major upgrades to `eslint` it is recommended to update both eslint and `eslint-config-uphold` and keep them in parallel. This is down to the fact that no guarantee is made that minor upgrades do not cause conflicts or issues with existing or new rules. The downside here is a package update is required for any security or other bug fixes. The benefit however is the included rules are always guaranteed to be stable.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-config-uphold",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.3.0",
|
|
4
4
|
"description": "Uphold-flavored ESLint config",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"config",
|
|
@@ -19,37 +19,42 @@
|
|
|
19
19
|
"type": "git",
|
|
20
20
|
"url": "git+ssh://git@github.com/uphold/eslint-config-uphold.git"
|
|
21
21
|
},
|
|
22
|
+
"files": [
|
|
23
|
+
"src"
|
|
24
|
+
],
|
|
22
25
|
"scripts": {
|
|
23
|
-
"changelog": "github-changelog-generator --future-release
|
|
24
|
-
"lint": "eslint
|
|
26
|
+
"changelog": "echo \"$(github-changelog-generator --owner uphold --repo eslint-config-uphold --future-release=$npm_package_version)\n$(tail -n +2 CHANGELOG.md)\" > CHANGELOG.md",
|
|
27
|
+
"lint": "eslint src test/index.js",
|
|
25
28
|
"test": "mocha $npm_package_options_mocha",
|
|
26
29
|
"version": "npm run changelog --future-release=$npm_package_version && git add -A CHANGELOG.md"
|
|
27
30
|
},
|
|
28
31
|
"dependencies": {
|
|
29
|
-
"babel
|
|
30
|
-
"eslint-
|
|
32
|
+
"@babel/core": "^7.16.12",
|
|
33
|
+
"@babel/eslint-parser": "^7.16.5",
|
|
34
|
+
"eslint-config-prettier": "^7.2.0",
|
|
31
35
|
"eslint-plugin-mocha": "^5.3.0",
|
|
32
|
-
"eslint-plugin-prettier": "^3.1
|
|
36
|
+
"eslint-plugin-prettier": "^3.3.1",
|
|
37
|
+
"eslint-plugin-rulesdir": "^0.1.0",
|
|
33
38
|
"eslint-plugin-sort-imports-es6": "^0.0.3",
|
|
34
39
|
"eslint-plugin-sql-template": "^2.0.0"
|
|
35
40
|
},
|
|
36
41
|
"devDependencies": {
|
|
37
|
-
"@uphold/github-changelog-generator": "^
|
|
38
|
-
"eslint": "
|
|
39
|
-
"mocha": "^
|
|
42
|
+
"@uphold/github-changelog-generator": "^3.0.0",
|
|
43
|
+
"eslint": "~8.7.0",
|
|
44
|
+
"mocha": "^9.2.0",
|
|
40
45
|
"pre-commit": "^1.2.2",
|
|
41
|
-
"prettier": "^
|
|
46
|
+
"prettier": "^2.2.1",
|
|
42
47
|
"should": "^9.0.2"
|
|
43
48
|
},
|
|
44
49
|
"peerDependencies": {
|
|
45
|
-
"eslint": "
|
|
46
|
-
"prettier": "^
|
|
50
|
+
"eslint": "~8.7.0",
|
|
51
|
+
"prettier": "^2.2.1"
|
|
47
52
|
},
|
|
48
53
|
"pre-commit": [
|
|
49
54
|
"lint"
|
|
50
55
|
],
|
|
51
56
|
"engines": {
|
|
52
|
-
"node": ">=
|
|
57
|
+
"node": ">=12.22"
|
|
53
58
|
},
|
|
54
59
|
"options": {
|
|
55
60
|
"mocha": "-t 10000 --require should test"
|
package/src/index.js
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Module dependencies.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
const rulesDir = require('eslint-plugin-rulesdir');
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Configure the rulesdir plugin.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
rulesDir.RULES_DIR = `${__dirname}/rules`;
|
|
12
|
+
|
|
1
13
|
/**
|
|
2
14
|
* Export `uphold` shared configuration preset.
|
|
3
15
|
*/
|
|
@@ -11,37 +23,27 @@ module.exports = {
|
|
|
11
23
|
node: true
|
|
12
24
|
},
|
|
13
25
|
extends: ['eslint:recommended', 'plugin:prettier/recommended'],
|
|
14
|
-
parser: 'babel-
|
|
15
|
-
|
|
26
|
+
parser: '@babel/eslint-parser',
|
|
27
|
+
parserOptions: {
|
|
28
|
+
requireConfigFile: false
|
|
29
|
+
},
|
|
30
|
+
plugins: ['mocha', 'rulesdir', 'sort-imports-es6', 'sql-template'],
|
|
16
31
|
root: true,
|
|
17
32
|
rules: {
|
|
18
33
|
'accessor-pairs': 'error',
|
|
34
|
+
'array-callback-return': 'error',
|
|
19
35
|
'block-scoped-var': 'error',
|
|
20
36
|
'consistent-this': ['error', 'self'],
|
|
21
37
|
curly: 'error',
|
|
22
38
|
'default-case': 'error',
|
|
23
39
|
'dot-notation': 'error',
|
|
24
40
|
eqeqeq: ['error', 'smart'],
|
|
25
|
-
'func-style': [
|
|
26
|
-
|
|
27
|
-
'declaration',
|
|
28
|
-
{
|
|
29
|
-
allowArrowFunctions: true
|
|
30
|
-
}
|
|
31
|
-
],
|
|
32
|
-
'id-length': [
|
|
33
|
-
'error',
|
|
34
|
-
{
|
|
35
|
-
exceptions: ['_', 'e', 'i']
|
|
36
|
-
}
|
|
37
|
-
],
|
|
41
|
+
'func-style': ['error', 'declaration', { allowArrowFunctions: true }],
|
|
42
|
+
'id-length': ['error', { exceptions: ['_', 'e', 'i'] }],
|
|
38
43
|
'id-match': [
|
|
39
44
|
'error',
|
|
40
45
|
'^_$|^[$_a-zA-Z]*[_a-zA-Z0-9]*[a-zA-Z0-9]*$|^[A-Z][_A-Z0-9]+[A-Z0-9]$',
|
|
41
|
-
{
|
|
42
|
-
onlyDeclarations: true,
|
|
43
|
-
properties: true
|
|
44
|
-
}
|
|
46
|
+
{ onlyDeclarations: true, properties: true }
|
|
45
47
|
],
|
|
46
48
|
'max-depth': 'error',
|
|
47
49
|
'max-params': ['error', 4],
|
|
@@ -64,6 +66,7 @@ module.exports = {
|
|
|
64
66
|
'no-extra-bind': 'error',
|
|
65
67
|
'no-implied-eval': 'error',
|
|
66
68
|
'no-inline-comments': 'error',
|
|
69
|
+
'no-irregular-whitespace': ['error', { skipComments: false, skipStrings: false, skipTemplates: false }],
|
|
67
70
|
'no-iterator': 'error',
|
|
68
71
|
'no-labels': 'error',
|
|
69
72
|
'no-lone-blocks': 'error',
|
|
@@ -88,6 +91,7 @@ module.exports = {
|
|
|
88
91
|
'no-self-compare': 'error',
|
|
89
92
|
'no-sequences': 'error',
|
|
90
93
|
'no-sync': 'error',
|
|
94
|
+
'no-tabs': ['error', { allowIndentationTabs: true }],
|
|
91
95
|
'no-throw-literal': 'error',
|
|
92
96
|
'no-undef-init': 'error',
|
|
93
97
|
'no-underscore-dangle': 'error',
|
|
@@ -110,14 +114,8 @@ module.exports = {
|
|
|
110
114
|
'prefer-destructuring': [
|
|
111
115
|
'error',
|
|
112
116
|
{
|
|
113
|
-
AssignmentExpression: {
|
|
114
|
-
|
|
115
|
-
object: false
|
|
116
|
-
},
|
|
117
|
-
VariableDeclarator: {
|
|
118
|
-
array: true,
|
|
119
|
-
object: true
|
|
120
|
-
}
|
|
117
|
+
AssignmentExpression: { array: false, object: false },
|
|
118
|
+
VariableDeclarator: { array: true, object: true }
|
|
121
119
|
},
|
|
122
120
|
{
|
|
123
121
|
enforceForRenamedProperties: false
|
|
@@ -125,16 +123,11 @@ module.exports = {
|
|
|
125
123
|
],
|
|
126
124
|
'prefer-spread': 'error',
|
|
127
125
|
'prefer-template': 'error',
|
|
128
|
-
'prettier/prettier': [
|
|
129
|
-
'error',
|
|
130
|
-
{
|
|
131
|
-
printWidth: 120,
|
|
132
|
-
singleQuote: true
|
|
133
|
-
}
|
|
134
|
-
],
|
|
126
|
+
'prettier/prettier': ['error', { arrowParens: 'avoid', printWidth: 120, singleQuote: true, trailingComma: 'none' }],
|
|
135
127
|
radix: 'error',
|
|
136
128
|
'require-atomic-updates': 'off',
|
|
137
129
|
'require-await': 'error',
|
|
130
|
+
'rulesdir/explicit-sinon-use-fake-timers': 'error',
|
|
138
131
|
'sort-imports-es6/sort-imports-es6': [
|
|
139
132
|
'error',
|
|
140
133
|
{
|
|
@@ -143,13 +136,7 @@ module.exports = {
|
|
|
143
136
|
memberSyntaxSortOrder: ['none', 'all', 'multiple', 'single']
|
|
144
137
|
}
|
|
145
138
|
],
|
|
146
|
-
'sort-keys': [
|
|
147
|
-
'error',
|
|
148
|
-
'asc',
|
|
149
|
-
{
|
|
150
|
-
natural: true
|
|
151
|
-
}
|
|
152
|
-
],
|
|
139
|
+
'sort-keys': ['error', 'asc', { natural: true }],
|
|
153
140
|
'spaced-comment': 'error',
|
|
154
141
|
'sql-template/no-unsafe-query': 'error',
|
|
155
142
|
'valid-jsdoc': 'error',
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// ------------------------------------------------------------------------------
|
|
4
|
+
// Validates that `sinon.useFakeTimers()` is always called with an explicit `toFake` property.
|
|
5
|
+
// ------------------------------------------------------------------------------
|
|
6
|
+
|
|
7
|
+
module.exports = {
|
|
8
|
+
meta: {
|
|
9
|
+
messages: {
|
|
10
|
+
avoidName: 'Calls to `sinon.useFakeTimers()` must provide a `toFake` configuration'
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
// eslint-disable-next-line sort-keys
|
|
14
|
+
create(context) {
|
|
15
|
+
return {
|
|
16
|
+
CallExpression(node) {
|
|
17
|
+
if (!node.callee || !node.callee.object || !node.callee.property) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
if (node.callee.object.name === 'sinon' && node.callee.property.name === 'useFakeTimers') {
|
|
22
|
+
if (!node.arguments.length) {
|
|
23
|
+
context.report({
|
|
24
|
+
message: 'Must pass an object with `toFake` configuration',
|
|
25
|
+
node
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
for (const argument of node.arguments) {
|
|
30
|
+
if (argument.type === 'ObjectExpression') {
|
|
31
|
+
if (!argument.properties.find(({ key: { name } }) => name === 'toFake')) {
|
|
32
|
+
context.report({
|
|
33
|
+
message: 'Object must contain `toFake` configuration',
|
|
34
|
+
node
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
continue;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
context.report({
|
|
42
|
+
message: 'Not an object',
|
|
43
|
+
node
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
};
|
package/.travis.yml
DELETED
package/test/fixtures/correct.js
DELETED
|
@@ -1,210 +0,0 @@
|
|
|
1
|
-
// env: jasmine.
|
|
2
|
-
try {
|
|
3
|
-
fail();
|
|
4
|
-
} catch (e) {
|
|
5
|
-
// eslint-disable-line no-empty
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
// env: jest and mocha.
|
|
9
|
-
describe();
|
|
10
|
-
|
|
11
|
-
// Avoid extra `no-unused-vars` violations.
|
|
12
|
-
function noop() {
|
|
13
|
-
// do nothing
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
// `consistent-this`.
|
|
17
|
-
const self = this;
|
|
18
|
-
|
|
19
|
-
noop(self);
|
|
20
|
-
|
|
21
|
-
// `curly`.
|
|
22
|
-
let mixedRules = true;
|
|
23
|
-
|
|
24
|
-
if (mixedRules) {
|
|
25
|
-
mixedRules = false;
|
|
26
|
-
} else {
|
|
27
|
-
mixedRules = true;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
// `dot-notation`.
|
|
31
|
-
const dotNotation = {};
|
|
32
|
-
|
|
33
|
-
dotNotation.foo = 'bar';
|
|
34
|
-
|
|
35
|
-
// `id-match`.
|
|
36
|
-
let idmatch;
|
|
37
|
-
let idMatch;
|
|
38
|
-
let IdMatch;
|
|
39
|
-
let IDMatch;
|
|
40
|
-
let IDMATCH;
|
|
41
|
-
let ID_MATCH;
|
|
42
|
-
let ID_M_ATCH;
|
|
43
|
-
|
|
44
|
-
noop(idmatch);
|
|
45
|
-
noop(idMatch);
|
|
46
|
-
noop(IdMatch);
|
|
47
|
-
noop(IDMatch);
|
|
48
|
-
noop(IDMATCH);
|
|
49
|
-
noop(ID_MATCH);
|
|
50
|
-
noop(ID_M_ATCH);
|
|
51
|
-
noop(__dirname);
|
|
52
|
-
noop(`${__dirname}`);
|
|
53
|
-
|
|
54
|
-
// `mocha/no-exclusive-tests`.
|
|
55
|
-
describe('noExclusiveTests', () => {
|
|
56
|
-
it('should work');
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
// `new-cap`.
|
|
60
|
-
const Cap = require('cap');
|
|
61
|
-
const newCap = new Cap();
|
|
62
|
-
|
|
63
|
-
noop(newCap);
|
|
64
|
-
|
|
65
|
-
// `no-class-assign`.
|
|
66
|
-
class NoClassAssign {}
|
|
67
|
-
|
|
68
|
-
noop(NoClassAssign);
|
|
69
|
-
|
|
70
|
-
// `no-const-assign`.
|
|
71
|
-
let noConstAssign = true;
|
|
72
|
-
|
|
73
|
-
noConstAssign = false;
|
|
74
|
-
|
|
75
|
-
noop(noConstAssign);
|
|
76
|
-
|
|
77
|
-
// `no-constant-condition`.
|
|
78
|
-
const noConstantCondition = true;
|
|
79
|
-
|
|
80
|
-
if (noConstantCondition) {
|
|
81
|
-
noop(noConstantCondition);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
// `no-dupe-class-members`.
|
|
85
|
-
class NoDupeClassMembers {
|
|
86
|
-
bar() {
|
|
87
|
-
return 'bar';
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
foo() {
|
|
91
|
-
return 'foo';
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
noop(NoDupeClassMembers);
|
|
96
|
-
|
|
97
|
-
// `no-labels`.
|
|
98
|
-
const noLabels = { label: true };
|
|
99
|
-
|
|
100
|
-
while (noLabels.label) {
|
|
101
|
-
break;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
// `no-multi-str`.
|
|
105
|
-
const noMultiStr = `Line 1
|
|
106
|
-
Line 2`;
|
|
107
|
-
|
|
108
|
-
noop(noMultiStr);
|
|
109
|
-
|
|
110
|
-
// `no-this-before-super`.
|
|
111
|
-
const NoThisBeforeSuper = require('no-this-before-super');
|
|
112
|
-
|
|
113
|
-
class Child extends NoThisBeforeSuper {
|
|
114
|
-
constructor() {
|
|
115
|
-
super();
|
|
116
|
-
this.foo = 'bar';
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
noop(Child);
|
|
121
|
-
|
|
122
|
-
// `padding-line-between-statements`.
|
|
123
|
-
const newLineAfterVar = 'foo';
|
|
124
|
-
|
|
125
|
-
noop(newLineAfterVar);
|
|
126
|
-
|
|
127
|
-
function funcThatReturns(bar) {
|
|
128
|
-
if (!bar) {
|
|
129
|
-
return;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
return bar;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
funcThatReturns('foo');
|
|
136
|
-
|
|
137
|
-
// `prefer-destructuring`.
|
|
138
|
-
let { bar } = {};
|
|
139
|
-
let [biz] = bar;
|
|
140
|
-
let baz = bar[biz];
|
|
141
|
-
|
|
142
|
-
bar.baz = bar.biz;
|
|
143
|
-
bar = biz.bar;
|
|
144
|
-
biz = baz[0];
|
|
145
|
-
baz = bar;
|
|
146
|
-
|
|
147
|
-
// `prettier/prettier`.
|
|
148
|
-
const singleQuote = 'true';
|
|
149
|
-
|
|
150
|
-
noop(singleQuote);
|
|
151
|
-
|
|
152
|
-
const maximumLineLength = '120';
|
|
153
|
-
|
|
154
|
-
noop(maximumLineLength);
|
|
155
|
-
|
|
156
|
-
// `require-atomic-updates`.
|
|
157
|
-
(async (foo = {}) => {
|
|
158
|
-
await foo;
|
|
159
|
-
|
|
160
|
-
foo.bar = 'biz';
|
|
161
|
-
})();
|
|
162
|
-
|
|
163
|
-
// `require-await`.
|
|
164
|
-
(async () => {
|
|
165
|
-
await noop();
|
|
166
|
-
})();
|
|
167
|
-
|
|
168
|
-
// `sort-imports`.
|
|
169
|
-
import 'import-1';
|
|
170
|
-
import * as Import6 from 'import-2';
|
|
171
|
-
import { Import5, import4 } from 'import-3';
|
|
172
|
-
import { import3 } from 'import-4';
|
|
173
|
-
import Import2 from 'import-5';
|
|
174
|
-
import import1 from 'import-6';
|
|
175
|
-
|
|
176
|
-
noop(Import2);
|
|
177
|
-
noop(Import5);
|
|
178
|
-
noop(Import6);
|
|
179
|
-
noop(import1);
|
|
180
|
-
noop(import3);
|
|
181
|
-
noop(import4);
|
|
182
|
-
|
|
183
|
-
// `sort-keys`.
|
|
184
|
-
const sortObjectProps = {
|
|
185
|
-
var1: 'foo',
|
|
186
|
-
var9: 'bar',
|
|
187
|
-
var10: 'biz'
|
|
188
|
-
};
|
|
189
|
-
|
|
190
|
-
noop(sortObjectProps);
|
|
191
|
-
|
|
192
|
-
// `spaced-comment`.
|
|
193
|
-
// spaced comment.
|
|
194
|
-
|
|
195
|
-
// `sql-template/no-unsafe-query`.
|
|
196
|
-
const db = {
|
|
197
|
-
query: noop()
|
|
198
|
-
};
|
|
199
|
-
const foo = 'foo';
|
|
200
|
-
const sql = 'sql-tag';
|
|
201
|
-
|
|
202
|
-
db.query(sql`SELECT ${foo} FROM bar`);
|
|
203
|
-
db.query(`SELECT foo FROM bar`);
|
|
204
|
-
|
|
205
|
-
// `yoda`.
|
|
206
|
-
let yoda = true;
|
|
207
|
-
|
|
208
|
-
if (yoda === true) {
|
|
209
|
-
yoda = false;
|
|
210
|
-
}
|
|
@@ -1,184 +0,0 @@
|
|
|
1
|
-
// Avoid extra `no-unused-vars` violations.
|
|
2
|
-
function noop() {
|
|
3
|
-
// do nothing
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
// `consistent-this`.
|
|
7
|
-
const consistentThis = this;
|
|
8
|
-
|
|
9
|
-
noop(consistentThis);
|
|
10
|
-
|
|
11
|
-
// `curly`.
|
|
12
|
-
let curly = true;
|
|
13
|
-
|
|
14
|
-
if (curly) curly = false;
|
|
15
|
-
|
|
16
|
-
// `dot-notation`.
|
|
17
|
-
const dotNotation = {};
|
|
18
|
-
|
|
19
|
-
dotNotation['foo'] = 'bar';
|
|
20
|
-
|
|
21
|
-
// `id-match`.
|
|
22
|
-
let id_mátch;
|
|
23
|
-
|
|
24
|
-
noop(id_mátch);
|
|
25
|
-
|
|
26
|
-
// `mocha/no-exclusive-tests`.
|
|
27
|
-
describe.only('noExclusiveTests', () => {
|
|
28
|
-
it('should not work');
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
// `mocha/no-identical-title`.
|
|
32
|
-
describe('noIdenticalTitle', () => {
|
|
33
|
-
it('should not work');
|
|
34
|
-
it('should not work');
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
// `mocha/no-nested-tests`.
|
|
38
|
-
it('noNestedTests', () => {
|
|
39
|
-
it('should not work');
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
// `mocha/no-sibling-hooks`.
|
|
43
|
-
describe('noSiblingHooks', () => {
|
|
44
|
-
before(() => {});
|
|
45
|
-
before(() => {});
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
// `new-cap`.
|
|
49
|
-
const cap = require('cap');
|
|
50
|
-
|
|
51
|
-
new cap();
|
|
52
|
-
|
|
53
|
-
// `no-class-assign`.
|
|
54
|
-
class NoClassAssign {}
|
|
55
|
-
|
|
56
|
-
NoClassAssign = 'foobar';
|
|
57
|
-
|
|
58
|
-
noop(NoClassAssign);
|
|
59
|
-
|
|
60
|
-
// `no-const-assign`.
|
|
61
|
-
const noConstAssign = true;
|
|
62
|
-
|
|
63
|
-
noConstAssign = false;
|
|
64
|
-
|
|
65
|
-
noop(noConstAssign);
|
|
66
|
-
|
|
67
|
-
// `no-constant-condition`.
|
|
68
|
-
if (true) {
|
|
69
|
-
noop(true);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
// `no-dupe-class-members`.
|
|
73
|
-
class NoDupeClassMembers {
|
|
74
|
-
foo() {
|
|
75
|
-
return 'bar';
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
foo() {
|
|
79
|
-
return 'foo';
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
noop(NoDupeClassMembers);
|
|
84
|
-
|
|
85
|
-
// `no-labels`.
|
|
86
|
-
noLabels: {
|
|
87
|
-
break noLabels;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
// `no-multi-str`.
|
|
91
|
-
const noMultiStr = 'Line 1 \
|
|
92
|
-
Line 2';
|
|
93
|
-
|
|
94
|
-
noop(noMultiStr);
|
|
95
|
-
|
|
96
|
-
// `no-this-before-super`.
|
|
97
|
-
const NoThisBeforeSuper = require('no-this-before-super');
|
|
98
|
-
|
|
99
|
-
class Child extends NoThisBeforeSuper {
|
|
100
|
-
constructor() {
|
|
101
|
-
this.foo = 'bar';
|
|
102
|
-
super();
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
noop(Child);
|
|
107
|
-
|
|
108
|
-
// `no-underscore-dangle`.
|
|
109
|
-
class NoUnderscoreDangle {
|
|
110
|
-
constructor() {
|
|
111
|
-
this._foo();
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
noop(new NoUnderscoreDangle());
|
|
116
|
-
|
|
117
|
-
// `no-unused-vars`
|
|
118
|
-
const foobar = '';
|
|
119
|
-
|
|
120
|
-
// `padding-line-between-statements`.
|
|
121
|
-
const newLineAfterVar = 'foo';
|
|
122
|
-
noop(newLineAfterVar);
|
|
123
|
-
|
|
124
|
-
function funcThatReturns(bar) {
|
|
125
|
-
if (!bar) {
|
|
126
|
-
return;
|
|
127
|
-
}
|
|
128
|
-
return bar;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
funcThatReturns('foo');
|
|
132
|
-
|
|
133
|
-
// `prefer-destructuring`.
|
|
134
|
-
const bar = {};
|
|
135
|
-
const biz = bar.biz;
|
|
136
|
-
const baz = biz[0];
|
|
137
|
-
|
|
138
|
-
noop(biz, baz);
|
|
139
|
-
|
|
140
|
-
// `prettier/prettier`.
|
|
141
|
-
const singleQuote = "true";
|
|
142
|
-
|
|
143
|
-
noop(singleQuote);
|
|
144
|
-
|
|
145
|
-
const maximumLineLength = 'prettier dictates that lines of code must not exceed a length limit of 120 characters maximum';
|
|
146
|
-
|
|
147
|
-
noop(maximumLineLength);
|
|
148
|
-
|
|
149
|
-
// `require-await`.
|
|
150
|
-
(async () => {})();
|
|
151
|
-
|
|
152
|
-
// `sort-imports`.
|
|
153
|
-
import import1 from 'import-1';
|
|
154
|
-
import { import2 } from 'import-2';
|
|
155
|
-
|
|
156
|
-
noop(import1);
|
|
157
|
-
noop(import2);
|
|
158
|
-
|
|
159
|
-
// `sort-keys`.
|
|
160
|
-
const sortObjectProps = {
|
|
161
|
-
var1: 'foo',
|
|
162
|
-
var10: 'bar',
|
|
163
|
-
var9: 'biz'
|
|
164
|
-
};
|
|
165
|
-
|
|
166
|
-
noop(sortObjectProps);
|
|
167
|
-
|
|
168
|
-
// `spaced-comment`.
|
|
169
|
-
//Comment missing space.
|
|
170
|
-
|
|
171
|
-
// `sql-template/no-unsafe-query`.
|
|
172
|
-
const db = {
|
|
173
|
-
query: noop()
|
|
174
|
-
};
|
|
175
|
-
const foo = 'foo';
|
|
176
|
-
|
|
177
|
-
db.query(`SELECT ${foo} FROM bar`);
|
|
178
|
-
|
|
179
|
-
// `yoda`.
|
|
180
|
-
let yoda = true;
|
|
181
|
-
|
|
182
|
-
if (true === yoda) {
|
|
183
|
-
yoda = false;
|
|
184
|
-
}
|