eslint-config-uphold 1.0.0 → 2.2.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/LICENSE +21 -0
- package/README.md +23 -4
- package/package.json +18 -13
- package/src/index.js +27 -41
- package/src/rules/explicit-sinon-use-fake-timers.js +50 -0
- package/.travis.yml +0 -12
- package/CHANGELOG.md +0 -28
- package/test/fixtures/correct.js +0 -210
- package/test/fixtures/incorrect.js +0 -184
- package/test/index.js +0 -60
- package/yarn.lock +0 -1168
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2016 Uphold
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,22 +1,27 @@
|
|
|
1
1
|
# eslint-config-uphold
|
|
2
2
|
|
|
3
|
-
Uphold-flavored ESLint config.
|
|
3
|
+
Uphold-flavored [ESLint](https://eslint.org/) config.
|
|
4
|
+
|
|
5
|
+
The [rules defined here](https://github.com/uphold/eslint-config-uphold/blob/master/src/index.js)
|
|
6
|
+
extend the [eslint-recommended](https://github.com/eslint/eslint/blob/master/conf/eslint-recommended.js) preset,
|
|
7
|
+
as well as the [overrides](https://github.com/prettier/eslint-config-prettier/blob/master/index.js)
|
|
8
|
+
that allow the [Prettier](https://prettier.io) pretty-printer to reformat the code without conflicts.
|
|
4
9
|
|
|
5
10
|
## Installation
|
|
6
11
|
|
|
7
12
|
```sh
|
|
8
|
-
$ npm install eslint eslint-config-uphold --save-dev
|
|
13
|
+
$ npm install eslint eslint-config-uphold prettier --save-dev
|
|
9
14
|
```
|
|
10
15
|
|
|
11
16
|
## Usage
|
|
12
17
|
|
|
13
|
-
Create an `.eslintrc.yml` file with the following:
|
|
18
|
+
Create an `.eslintrc.yml` file with the following content:
|
|
14
19
|
|
|
15
20
|
```yaml
|
|
16
21
|
extends: uphold
|
|
17
22
|
```
|
|
18
23
|
|
|
19
|
-
Add
|
|
24
|
+
Add a `lint` command to the `scripts` section of your `package.json`, like so:
|
|
20
25
|
|
|
21
26
|
```json
|
|
22
27
|
{
|
|
@@ -31,3 +36,17 @@ and run the linter with:
|
|
|
31
36
|
```sh
|
|
32
37
|
$ npm run lint
|
|
33
38
|
```
|
|
39
|
+
|
|
40
|
+
To automatically fix all lint issues, use the `--fix` option:
|
|
41
|
+
|
|
42
|
+
```sh
|
|
43
|
+
$ npm run lint --fix
|
|
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.2.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": "^0.
|
|
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": ">=10.23.2"
|
|
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,8 +23,11 @@ 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',
|
|
@@ -22,26 +37,12 @@ module.exports = {
|
|
|
22
37
|
'default-case': 'error',
|
|
23
38
|
'dot-notation': 'error',
|
|
24
39
|
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
|
-
],
|
|
40
|
+
'func-style': ['error', 'declaration', { allowArrowFunctions: true }],
|
|
41
|
+
'id-length': ['error', { exceptions: ['_', 'e', 'i'] }],
|
|
38
42
|
'id-match': [
|
|
39
43
|
'error',
|
|
40
44
|
'^_$|^[$_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
|
-
}
|
|
45
|
+
{ onlyDeclarations: true, properties: true }
|
|
45
46
|
],
|
|
46
47
|
'max-depth': 'error',
|
|
47
48
|
'max-params': ['error', 4],
|
|
@@ -64,6 +65,7 @@ module.exports = {
|
|
|
64
65
|
'no-extra-bind': 'error',
|
|
65
66
|
'no-implied-eval': 'error',
|
|
66
67
|
'no-inline-comments': 'error',
|
|
68
|
+
'no-irregular-whitespace': ['error', { skipComments: false, skipStrings: false, skipTemplates: false }],
|
|
67
69
|
'no-iterator': 'error',
|
|
68
70
|
'no-labels': 'error',
|
|
69
71
|
'no-lone-blocks': 'error',
|
|
@@ -88,6 +90,7 @@ module.exports = {
|
|
|
88
90
|
'no-self-compare': 'error',
|
|
89
91
|
'no-sequences': 'error',
|
|
90
92
|
'no-sync': 'error',
|
|
93
|
+
'no-tabs': ['error', { allowIndentationTabs: true }],
|
|
91
94
|
'no-throw-literal': 'error',
|
|
92
95
|
'no-undef-init': 'error',
|
|
93
96
|
'no-underscore-dangle': 'error',
|
|
@@ -110,14 +113,8 @@ module.exports = {
|
|
|
110
113
|
'prefer-destructuring': [
|
|
111
114
|
'error',
|
|
112
115
|
{
|
|
113
|
-
AssignmentExpression: {
|
|
114
|
-
|
|
115
|
-
object: false
|
|
116
|
-
},
|
|
117
|
-
VariableDeclarator: {
|
|
118
|
-
array: true,
|
|
119
|
-
object: true
|
|
120
|
-
}
|
|
116
|
+
AssignmentExpression: { array: false, object: false },
|
|
117
|
+
VariableDeclarator: { array: true, object: true }
|
|
121
118
|
},
|
|
122
119
|
{
|
|
123
120
|
enforceForRenamedProperties: false
|
|
@@ -125,16 +122,11 @@ module.exports = {
|
|
|
125
122
|
],
|
|
126
123
|
'prefer-spread': 'error',
|
|
127
124
|
'prefer-template': 'error',
|
|
128
|
-
'prettier/prettier': [
|
|
129
|
-
'error',
|
|
130
|
-
{
|
|
131
|
-
printWidth: 120,
|
|
132
|
-
singleQuote: true
|
|
133
|
-
}
|
|
134
|
-
],
|
|
125
|
+
'prettier/prettier': ['error', { arrowParens: 'avoid', printWidth: 120, singleQuote: true, trailingComma: 'none' }],
|
|
135
126
|
radix: 'error',
|
|
136
127
|
'require-atomic-updates': 'off',
|
|
137
128
|
'require-await': 'error',
|
|
129
|
+
'rulesdir/explicit-sinon-use-fake-timers': 'error',
|
|
138
130
|
'sort-imports-es6/sort-imports-es6': [
|
|
139
131
|
'error',
|
|
140
132
|
{
|
|
@@ -143,13 +135,7 @@ module.exports = {
|
|
|
143
135
|
memberSyntaxSortOrder: ['none', 'all', 'multiple', 'single']
|
|
144
136
|
}
|
|
145
137
|
],
|
|
146
|
-
'sort-keys': [
|
|
147
|
-
'error',
|
|
148
|
-
'asc',
|
|
149
|
-
{
|
|
150
|
-
natural: true
|
|
151
|
-
}
|
|
152
|
-
],
|
|
138
|
+
'sort-keys': ['error', 'asc', { natural: true }],
|
|
153
139
|
'spaced-comment': 'error',
|
|
154
140
|
'sql-template/no-unsafe-query': 'error',
|
|
155
141
|
'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/CHANGELOG.md
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
|
|
3
|
-
## [v1.0.0](https://github.com/uphold/eslint-config-uphold/releases/tag/v1.0.0) (2019-07-25)
|
|
4
|
-
- Remove redundant rules [\#19](https://github.com/uphold/eslint-config-uphold/pull/19) ([rplopes](https://github.com/rplopes))
|
|
5
|
-
- Add peer dependencies [\#20](https://github.com/uphold/eslint-config-uphold/pull/20) ([rplopes](https://github.com/rplopes))
|
|
6
|
-
- Add prettier and replace redundant rules [\#18](https://github.com/uphold/eslint-config-uphold/pull/18) ([rplopes](https://github.com/rplopes))
|
|
7
|
-
- Update eslint@6.0.1 [\#16](https://github.com/uphold/eslint-config-uphold/pull/16) ([rplopes](https://github.com/rplopes))
|
|
8
|
-
- Improve `id-match` [\#14](https://github.com/uphold/eslint-config-uphold/pull/14) ([rplopes](https://github.com/rplopes))
|
|
9
|
-
|
|
10
|
-
## [v0.2.0](https://github.com/uphold/eslint-config-uphold/releases/tag/v0.2.0) (2018-07-16)
|
|
11
|
-
- Add @uphold/github-changelog-generator [\#13](https://github.com/uphold/eslint-config-uphold/pull/13) ([Americas](https://github.com/Americas))
|
|
12
|
-
- Replace drone with travis [\#10](https://github.com/uphold/eslint-config-uphold/pull/10) ([Americas](https://github.com/Americas))
|
|
13
|
-
- Add pre-commit lint hook [\#12](https://github.com/uphold/eslint-config-uphold/pull/12) ([Americas](https://github.com/Americas))
|
|
14
|
-
- Raise minimum node engine requirement to 6 [\#11](https://github.com/uphold/eslint-config-uphold/pull/11) ([Americas](https://github.com/Americas))
|
|
15
|
-
- Fix linting errors [\#9](https://github.com/uphold/eslint-config-uphold/pull/9) ([Americas](https://github.com/Americas))
|
|
16
|
-
- Add new mocha rules [\#8](https://github.com/uphold/eslint-config-uphold/pull/8) ([rplopes](https://github.com/rplopes))
|
|
17
|
-
- Update eslint-plugin-mocha@^5.1.0 [\#7](https://github.com/uphold/eslint-config-uphold/pull/7) ([Americas](https://github.com/Americas))
|
|
18
|
-
|
|
19
|
-
## [v0.1.1](https://github.com/uphold/eslint-config-uphold/releases/tag/v0.1.1) (2018-03-20)
|
|
20
|
-
- Allow computed properties in prefer destructuring [\#5](https://github.com/uphold/eslint-config-uphold/pull/5) ([nunofgs](https://github.com/nunofgs))
|
|
21
|
-
|
|
22
|
-
## [v0.1.0](https://github.com/uphold/eslint-config-uphold/releases/tag/v0.1.0) (2017-12-26)
|
|
23
|
-
- Add `jasmine` and `jest` to eslint environments [\#4](https://github.com/uphold/eslint-config-uphold/pull/4) ([nunofgs](https://github.com/nunofgs))
|
|
24
|
-
|
|
25
|
-
## [v0.0.1](https://github.com/uphold/eslint-config-uphold/releases/tag/v0.0.1) (2017-09-07)
|
|
26
|
-
- Add prefer-destructuring rule [\#2](https://github.com/uphold/eslint-config-uphold/pull/2) ([nunofgs](https://github.com/nunofgs))
|
|
27
|
-
- Replace travis with drone [\#3](https://github.com/uphold/eslint-config-uphold/pull/3) ([franciscocardoso](https://github.com/franciscocardoso))
|
|
28
|
-
- Update eslint@4.4.1 [\#1](https://github.com/uphold/eslint-config-uphold/pull/1) ([nunofgs](https://github.com/nunofgs))
|
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
|
-
}
|