@wistia/eslint-config 0.3.7 → 0.5.2
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/README.md +15 -1
- package/cypress.js +11 -0
- package/eslintRules/cypress.js +11 -0
- package/eslintRules/sonar.js +39 -0
- package/jest.js +3 -0
- package/package.json +7 -5
- package/react.js +3 -0
- package/sonar.js +8 -0
package/README.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
1
|
# @wistia/eslint-config
|
|
2
2
|
|
|
3
|
-
Wistia's ESLint
|
|
3
|
+
Wistia's ESLint configuration. This repo is "pseudo-public" - private on our org, and [pushed to NPM](https://www.npmjs.com/package/@wistia/eslint-config) for ease of distribution.
|
|
4
|
+
|
|
5
|
+
## How to install
|
|
6
|
+
|
|
7
|
+
TODO!
|
|
8
|
+
|
|
9
|
+
## Guidelines for adding new rules
|
|
10
|
+
|
|
11
|
+
1. preference given for autofixable rules; for non-autofixable rules consider seeking consensus from co-workers (open a PR on this repo and ask for feedback in #engineering-general!)
|
|
12
|
+
2. should not contradict existing rules
|
|
13
|
+
3. person/team adding new rules handles upgrading consumers and fixing violations
|
|
14
|
+
|
|
15
|
+
## Publishing
|
|
16
|
+
|
|
17
|
+
TODO!
|
package/cypress.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// only add cypress rules
|
|
2
|
+
|
|
3
|
+
module.exports = {
|
|
4
|
+
'cypress/no-assigning-return-values': 'error',
|
|
5
|
+
'cypress/no-unnecessary-waiting': 'error',
|
|
6
|
+
'cypress/no-async-tests': 'error',
|
|
7
|
+
'cypress/no-force': 'error',
|
|
8
|
+
'cypress/assertion-before-screenshot': 'error',
|
|
9
|
+
'cypress/require-data-selectors': 'error',
|
|
10
|
+
'cypress/no-pause': 'error',
|
|
11
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// only add SonarJS rules
|
|
2
|
+
// https://github.com/SonarSource/eslint-plugin-sonarjs#rules
|
|
3
|
+
|
|
4
|
+
module.exports = {
|
|
5
|
+
// bug detection
|
|
6
|
+
'sonarjs/no-all-duplicated-branches': 'error',
|
|
7
|
+
'sonarjs/no-element-overwrite': 'error',
|
|
8
|
+
'sonarjs/no-empty-collection': 'error',
|
|
9
|
+
'sonarjs/no-extra-arguments': 'error',
|
|
10
|
+
'sonarjs/no-identical-conditions': 'error',
|
|
11
|
+
'sonarjs/no-identical-expressions': 'error',
|
|
12
|
+
'sonarjs/no-ignored-return': 'error',
|
|
13
|
+
'sonarjs/no-one-iteration-loop': 'error',
|
|
14
|
+
'sonarjs/no-use-of-empty-return-value': 'error',
|
|
15
|
+
'sonarjs/non-existent-operator': 'error',
|
|
16
|
+
// code smells
|
|
17
|
+
'sonarjs/cognitive-complexity': 'error',
|
|
18
|
+
'sonarjs/elseif-without-else': 'error',
|
|
19
|
+
'sonarjs/max-switch-cases': 'error',
|
|
20
|
+
'sonarjs/no-collapsible-if': 'error',
|
|
21
|
+
'sonarjs/no-collection-size-mischeck': 'error',
|
|
22
|
+
'sonarjs/no-duplicate-string': 'error',
|
|
23
|
+
'sonarjs/no-duplicated-branches': 'error',
|
|
24
|
+
'sonarjs/no-gratuitous-expressions': 'error',
|
|
25
|
+
'sonarjs/no-identical-functions': 'error',
|
|
26
|
+
'sonarjs/no-inverted-boolean-check': 'error',
|
|
27
|
+
'sonarjs/no-nested-switch': 'error',
|
|
28
|
+
'sonarjs/no-nested-template-literals': 'error',
|
|
29
|
+
'sonarjs/no-redundant-boolean': 'error',
|
|
30
|
+
'sonarjs/no-redundant-jump': 'error',
|
|
31
|
+
'sonarjs/no-same-line-conditional': 'error',
|
|
32
|
+
'sonarjs/no-small-switch': 'error',
|
|
33
|
+
'sonarjs/no-unused-collection': 'error',
|
|
34
|
+
'sonarjs/no-useless-catch': 'error',
|
|
35
|
+
'sonarjs/prefer-immediate-return': 'error',
|
|
36
|
+
'sonarjs/prefer-object-literal': 'error',
|
|
37
|
+
'sonarjs/prefer-single-boolean-return': 'error',
|
|
38
|
+
'sonarjs/prefer-while': 'error',
|
|
39
|
+
};
|
package/jest.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wistia/eslint-config",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.2",
|
|
4
4
|
"description": "Wistia's ESLint configurations",
|
|
5
5
|
"main": "react.js",
|
|
6
6
|
"scripts": {
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
"eslint-config-airbnb": "^19.0.4",
|
|
16
16
|
"eslint-config-prettier": "^8.5.0",
|
|
17
17
|
"eslint-plugin-better-styled-components": "^1.1.2",
|
|
18
|
+
"eslint-plugin-cypress": "^2.12.1",
|
|
18
19
|
"eslint-plugin-import": "^2.26.0",
|
|
19
20
|
"eslint-plugin-jest": "^26.1.5",
|
|
20
21
|
"eslint-plugin-jest-dom": "^4.0.1",
|
|
@@ -23,7 +24,8 @@
|
|
|
23
24
|
"eslint-plugin-prettier": "^4.0.0",
|
|
24
25
|
"eslint-plugin-react": "^7.29.4",
|
|
25
26
|
"eslint-plugin-react-hooks": "^4.5.0",
|
|
26
|
-
"eslint-plugin-
|
|
27
|
+
"eslint-plugin-sonarjs": "^0.13.0",
|
|
28
|
+
"eslint-plugin-styled-components-a11y": "^0.0.39",
|
|
27
29
|
"eslint-plugin-testing-library": "^5.3.1",
|
|
28
30
|
"postcss": "^8.4.13",
|
|
29
31
|
"postcss-scss": "^4.0.4",
|
|
@@ -38,9 +40,9 @@
|
|
|
38
40
|
"stylelint-scss": "^4.2.0"
|
|
39
41
|
},
|
|
40
42
|
"devDependencies": {
|
|
41
|
-
"@commitlint/cli": "^
|
|
42
|
-
"@commitlint/config-conventional": "^
|
|
43
|
-
"husky": "^
|
|
43
|
+
"@commitlint/cli": "^17.0.2",
|
|
44
|
+
"@commitlint/config-conventional": "^17.0.2",
|
|
45
|
+
"husky": "^8.0.1"
|
|
44
46
|
},
|
|
45
47
|
"engines": {
|
|
46
48
|
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
|
package/react.js
CHANGED
|
@@ -6,6 +6,9 @@ module.exports = {
|
|
|
6
6
|
parser: '@babel/eslint-parser',
|
|
7
7
|
plugins: ['eslint-plugin-prettier'],
|
|
8
8
|
extends: ['eslint-config-airbnb', 'eslint-config-airbnb/hooks', 'eslint-config-prettier'],
|
|
9
|
+
env: {
|
|
10
|
+
browser: true,
|
|
11
|
+
},
|
|
9
12
|
rules: {
|
|
10
13
|
...commonRules,
|
|
11
14
|
...a11yRules,
|