@wistia/eslint-config 0.7.0 → 0.7.1-beta.b88ec0ae.dff4a6b

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/base.js CHANGED
@@ -17,5 +17,4 @@ module.exports = {
17
17
  './rules/eslint/prettier',
18
18
  'eslint-config-prettier',
19
19
  ].map(require.resolve),
20
- rules: {},
21
20
  };
package/cypress.js CHANGED
@@ -1,11 +1,3 @@
1
- const testRules = require('./rules/eslint/cypress');
2
-
3
1
  module.exports = {
4
- plugins: ['eslint-plugin-cypress'],
5
- env: {
6
- 'cypress/globals': true,
7
- },
8
- rules: {
9
- ...testRules,
10
- },
2
+ extends: ['./rules/eslint/cypress'].map(require.resolve),
11
3
  };
package/jest.js CHANGED
@@ -1,11 +1,3 @@
1
- const testRules = require('./rules/eslint/jest');
2
-
3
1
  module.exports = {
4
- plugins: ['eslint-plugin-jest', 'eslint-plugin-jest-formatting'],
5
- env: {
6
- jest: true,
7
- },
8
- rules: {
9
- ...testRules,
10
- },
2
+ extends: ['./rules/eslint/jest'].map(require.resolve),
11
3
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wistia/eslint-config",
3
- "version": "0.7.0",
3
+ "version": "0.7.1-beta.b88ec0ae.dff4a6b",
4
4
  "description": "Wistia's ESLint configurations",
5
5
  "main": "react.js",
6
6
  "scripts": {
package/react.js CHANGED
@@ -8,11 +8,12 @@ module.exports = {
8
8
  // base
9
9
  './rules/eslint/best-practices',
10
10
  './rules/eslint/errors',
11
+ './rules/eslint/es6',
12
+ './rules/eslint/globals',
13
+ './rules/eslint/imports',
11
14
  './rules/eslint/node',
12
15
  './rules/eslint/style',
13
16
  './rules/eslint/variables',
14
- './rules/eslint/es6',
15
- './rules/eslint/imports',
16
17
  // react
17
18
  './rules/eslint/react',
18
19
  './rules/eslint/react-a11y',
@@ -20,5 +21,4 @@ module.exports = {
20
21
  './rules/eslint/prettier',
21
22
  'eslint-config-prettier',
22
23
  ].map(require.resolve),
23
- rules: {},
24
24
  };
@@ -2,11 +2,19 @@
2
2
  // see: https://github.com/cypress-io/eslint-plugin-cypress#rules
3
3
 
4
4
  module.exports = {
5
- 'cypress/no-assigning-return-values': 'error',
6
- 'cypress/no-unnecessary-waiting': 'error',
7
- 'cypress/no-async-tests': 'error',
8
- 'cypress/no-force': 'error',
9
- 'cypress/assertion-before-screenshot': 'error',
10
- 'cypress/require-data-selectors': 'error',
11
- 'cypress/no-pause': 'error',
5
+ env: {
6
+ 'cypress/globals': true,
7
+ },
8
+
9
+ plugins: ['eslint-plugin-cypress'],
10
+
11
+ rules: {
12
+ 'cypress/no-assigning-return-values': 'error',
13
+ 'cypress/no-unnecessary-waiting': 'error',
14
+ 'cypress/no-async-tests': 'error',
15
+ 'cypress/no-force': 'error',
16
+ 'cypress/assertion-before-screenshot': 'error',
17
+ 'cypress/require-data-selectors': 'error',
18
+ 'cypress/no-pause': 'error',
19
+ },
12
20
  };
@@ -99,7 +99,7 @@ module.exports = {
99
99
 
100
100
  // disallow require()
101
101
  // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-commonjs.md
102
- 'import/no-commonjs': 'off',
102
+ 'import/no-commonjs': 'error',
103
103
 
104
104
  // disallow AMD require/define
105
105
  // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-amd.md
@@ -3,58 +3,66 @@
3
3
  // see: https://github.com/dangreenisrael/eslint-plugin-jest-formatting#rule-documentation
4
4
 
5
5
  module.exports = {
6
- // authoring rules for tests
7
- 'jest/consistent-test-it': 'error',
8
- 'jest/expect-expect': 'off',
9
- 'jest/no-alias-methods': 'error',
10
- 'jest/no-commented-out-tests': 'error',
11
- 'jest/no-conditional-expect': 'error',
12
- 'jest/no-deprecated-functions': 'error',
13
- // it is often useful to be allowed to add a .skip
14
- 'jest/no-disabled-tests': 'off',
15
- 'jest/no-done-callback': 'error',
16
- 'jest/no-duplicate-hooks': 'error',
17
- 'jest/no-export': 'error',
18
- 'jest/no-focused-tests': 'error',
19
- // hooks are useful even though they *potentially* promote shared state between tests
20
- 'jest/no-hooks': 'off',
21
- 'jest/no-identical-title': 'error',
22
- 'jest/no-if': 'error',
23
- 'jest/no-interpolation-in-snapshots': 'error',
24
- 'jest/no-jasmine-globals': 'error',
25
- 'jest/no-jest-import': 'error',
26
- // reasonable but arbitrary size limit
27
- 'jest/no-large-snapshots': ['error', { maxSize: 500 }],
28
- 'jest/no-mocks-import': 'error',
29
- 'jest/no-restricted-matchers': 'error',
30
- 'jest/no-standalone-expect': 'error',
31
- 'jest/no-test-prefixes': 'error',
32
- 'jest/no-test-return-statement': 'error',
33
- 'jest/prefer-called-with': 'error',
34
- 'jest/prefer-expect-assertions': 'error',
35
- 'jest/prefer-hooks-on-top': 'error',
36
- // descriptions are often named after React components which are capitalized
37
- 'jest/prefer-lowercase-title': 'off',
38
- 'jest/prefer-spy-on': 'error',
39
- 'jest/prefer-strict-equal': 'error',
40
- 'jest/prefer-to-be': 'error',
41
- 'jest/prefer-to-contain': 'error',
42
- 'jest/prefer-to-have-length': 'error',
43
- 'jest/prefer-todo': 'error',
44
- 'jest/require-to-throw-message': 'error',
45
- 'jest/require-top-level-describe': 'error',
46
- 'jest/valid-describe-callback': 'error',
47
- 'jest/valid-expect': 'error',
48
- 'jest/valid-expect-in-promise': 'error',
49
- 'jest/valid-title': 'error',
6
+ env: {
7
+ jest: true,
8
+ },
50
9
 
51
- // formatting rules for tests
52
- 'jest-formatting/padding-around-after-all-blocks': 'error',
53
- 'jest-formatting/padding-around-after-each-blocks': 'error',
54
- 'jest-formatting/padding-around-before-all-blocks': 'error',
55
- 'jest-formatting/padding-around-before-each-blocks': 'error',
56
- 'jest-formatting/padding-around-expect-groups': 'error',
57
- 'jest-formatting/padding-around-describe-blocks': 'error',
58
- 'jest-formatting/padding-around-test-blocks': 'error',
59
- 'jest-formatting/padding-around-all': 'error',
10
+ plugins: ['eslint-plugin-jest', 'eslint-plugin-jest-formatting'],
11
+
12
+ rules: {
13
+ // authoring rules for tests
14
+ 'jest/consistent-test-it': 'error',
15
+ 'jest/expect-expect': 'off',
16
+ 'jest/no-alias-methods': 'error',
17
+ 'jest/no-commented-out-tests': 'error',
18
+ 'jest/no-conditional-expect': 'error',
19
+ 'jest/no-deprecated-functions': 'error',
20
+ // it is often useful to be allowed to add a .skip
21
+ 'jest/no-disabled-tests': 'off',
22
+ 'jest/no-done-callback': 'error',
23
+ 'jest/no-duplicate-hooks': 'error',
24
+ 'jest/no-export': 'error',
25
+ 'jest/no-focused-tests': 'error',
26
+ // hooks are useful even though they *potentially* promote shared state between tests
27
+ 'jest/no-hooks': 'off',
28
+ 'jest/no-identical-title': 'error',
29
+ 'jest/no-if': 'error',
30
+ 'jest/no-interpolation-in-snapshots': 'error',
31
+ 'jest/no-jasmine-globals': 'error',
32
+ 'jest/no-jest-import': 'error',
33
+ // reasonable but arbitrary size limit
34
+ 'jest/no-large-snapshots': ['error', { maxSize: 500 }],
35
+ 'jest/no-mocks-import': 'error',
36
+ 'jest/no-restricted-matchers': 'error',
37
+ 'jest/no-standalone-expect': 'error',
38
+ 'jest/no-test-prefixes': 'error',
39
+ 'jest/no-test-return-statement': 'error',
40
+ 'jest/prefer-called-with': 'error',
41
+ 'jest/prefer-expect-assertions': 'error',
42
+ 'jest/prefer-hooks-on-top': 'error',
43
+ // descriptions are often named after React components which are capitalized
44
+ 'jest/prefer-lowercase-title': 'off',
45
+ 'jest/prefer-spy-on': 'error',
46
+ 'jest/prefer-strict-equal': 'error',
47
+ 'jest/prefer-to-be': 'error',
48
+ 'jest/prefer-to-contain': 'error',
49
+ 'jest/prefer-to-have-length': 'error',
50
+ 'jest/prefer-todo': 'error',
51
+ 'jest/require-to-throw-message': 'error',
52
+ 'jest/require-top-level-describe': 'error',
53
+ 'jest/valid-describe-callback': 'error',
54
+ 'jest/valid-expect': 'error',
55
+ 'jest/valid-expect-in-promise': 'error',
56
+ 'jest/valid-title': 'error',
57
+
58
+ // formatting rules for tests
59
+ 'jest-formatting/padding-around-after-all-blocks': 'error',
60
+ 'jest-formatting/padding-around-after-each-blocks': 'error',
61
+ 'jest-formatting/padding-around-before-all-blocks': 'error',
62
+ 'jest-formatting/padding-around-before-each-blocks': 'error',
63
+ 'jest-formatting/padding-around-expect-groups': 'error',
64
+ 'jest-formatting/padding-around-describe-blocks': 'error',
65
+ 'jest-formatting/padding-around-test-blocks': 'error',
66
+ 'jest-formatting/padding-around-all': 'error',
67
+ },
60
68
  };
@@ -2,39 +2,42 @@
2
2
  // see: https://github.com/SonarSource/eslint-plugin-sonarjs#rules
3
3
 
4
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',
5
+ plugins: ['eslint-plugin-sonarjs'],
6
+ rules: {
7
+ // bug detection
8
+ 'sonarjs/no-all-duplicated-branches': 'error',
9
+ 'sonarjs/no-element-overwrite': 'error',
10
+ 'sonarjs/no-empty-collection': 'error',
11
+ 'sonarjs/no-extra-arguments': 'error',
12
+ 'sonarjs/no-identical-conditions': 'error',
13
+ 'sonarjs/no-identical-expressions': 'error',
14
+ 'sonarjs/no-ignored-return': 'error',
15
+ 'sonarjs/no-one-iteration-loop': 'error',
16
+ 'sonarjs/no-use-of-empty-return-value': 'error',
17
+ 'sonarjs/non-existent-operator': 'error',
16
18
 
17
- // code smells
18
- 'sonarjs/cognitive-complexity': 'error',
19
- 'sonarjs/elseif-without-else': 'error',
20
- 'sonarjs/max-switch-cases': 'error',
21
- 'sonarjs/no-collapsible-if': 'error',
22
- 'sonarjs/no-collection-size-mischeck': 'error',
23
- 'sonarjs/no-duplicate-string': 'off',
24
- 'sonarjs/no-duplicated-branches': 'error',
25
- 'sonarjs/no-gratuitous-expressions': 'error',
26
- 'sonarjs/no-identical-functions': 'error',
27
- 'sonarjs/no-inverted-boolean-check': 'error',
28
- 'sonarjs/no-nested-switch': 'error',
29
- 'sonarjs/no-nested-template-literals': 'error',
30
- 'sonarjs/no-redundant-boolean': 'error',
31
- 'sonarjs/no-redundant-jump': 'error',
32
- 'sonarjs/no-same-line-conditional': 'error',
33
- 'sonarjs/no-small-switch': 'error',
34
- 'sonarjs/no-unused-collection': 'error',
35
- 'sonarjs/no-useless-catch': 'error',
36
- 'sonarjs/prefer-immediate-return': 'error',
37
- 'sonarjs/prefer-object-literal': 'error',
38
- 'sonarjs/prefer-single-boolean-return': 'error',
39
- 'sonarjs/prefer-while': 'error',
19
+ // code smells
20
+ 'sonarjs/cognitive-complexity': 'error',
21
+ 'sonarjs/elseif-without-else': 'error',
22
+ 'sonarjs/max-switch-cases': 'error',
23
+ 'sonarjs/no-collapsible-if': 'error',
24
+ 'sonarjs/no-collection-size-mischeck': 'error',
25
+ 'sonarjs/no-duplicate-string': 'off',
26
+ 'sonarjs/no-duplicated-branches': 'error',
27
+ 'sonarjs/no-gratuitous-expressions': 'error',
28
+ 'sonarjs/no-identical-functions': 'error',
29
+ 'sonarjs/no-inverted-boolean-check': 'error',
30
+ 'sonarjs/no-nested-switch': 'error',
31
+ 'sonarjs/no-nested-template-literals': 'error',
32
+ 'sonarjs/no-redundant-boolean': 'error',
33
+ 'sonarjs/no-redundant-jump': 'error',
34
+ 'sonarjs/no-same-line-conditional': 'error',
35
+ 'sonarjs/no-small-switch': 'error',
36
+ 'sonarjs/no-unused-collection': 'error',
37
+ 'sonarjs/no-useless-catch': 'error',
38
+ 'sonarjs/prefer-immediate-return': 'error',
39
+ 'sonarjs/prefer-object-literal': 'error',
40
+ 'sonarjs/prefer-single-boolean-return': 'error',
41
+ 'sonarjs/prefer-while': 'error',
42
+ },
40
43
  };
@@ -3,6 +3,89 @@
3
3
  // see: https://github.com/brendanmorrell/eslint-plugin-styled-components-a11y
4
4
 
5
5
  module.exports = {
6
- // sort styled-component properties alphabetically
7
- 'better-styled-components/sort-declarations-alphabetically': 'error',
6
+ parserOptions: {
7
+ ecmaFeatures: {
8
+ jsx: true,
9
+ },
10
+ },
11
+ rules: {
12
+ // sort styled-component properties alphabetically
13
+ 'better-styled-components/sort-declarations-alphabetically': 'error',
14
+
15
+ 'styled-components-a11y/accessible-emoji': 'error',
16
+ 'styled-components-a11y/alt-text': 'error',
17
+ 'styled-components-a11y/anchor-has-content': 'error',
18
+ 'styled-components-a11y/anchor-is-valid': 'error',
19
+ 'styled-components-a11y/aria-activedescendant-has-tabindex': 'error',
20
+ 'styled-components-a11y/aria-props': 'error',
21
+ 'styled-components-a11y/aria-proptypes': 'error',
22
+ 'styled-components-a11y/aria-role': 'error',
23
+ 'styled-components-a11y/aria-unsupported-elements': 'error',
24
+ 'styled-components-a11y/autocomplete-valid': 'error',
25
+ 'styled-components-a11y/click-events-have-key-events': 'error',
26
+ 'styled-components-a11y/control-has-associated-label': [
27
+ 'error',
28
+ {
29
+ ignoreElements: ['audio', 'canvas', 'embed', 'input', 'textarea', 'tr', 'video'],
30
+ ignoreRoles: [
31
+ 'grid',
32
+ 'listbox',
33
+ 'menu',
34
+ 'menubar',
35
+ 'radiogroup',
36
+ 'row',
37
+ 'tablist',
38
+ 'toolbar',
39
+ 'tree',
40
+ 'treegrid',
41
+ ],
42
+ includeRoles: ['alert', 'dialog'],
43
+ },
44
+ ],
45
+ 'styled-components-a11y/heading-has-content': 'error',
46
+ 'styled-components-a11y/html-has-lang': 'error',
47
+ 'styled-components-a11y/iframe-has-title': 'error',
48
+ 'styled-components-a11y/img-redundant-alt': 'error',
49
+ 'styled-components-a11y/interactive-supports-focus': [
50
+ 'error',
51
+ {
52
+ tabbable: [
53
+ 'button',
54
+ 'checkbox',
55
+ 'link',
56
+ 'progressbar',
57
+ 'searchbox',
58
+ 'slider',
59
+ 'spinbutton',
60
+ 'switch',
61
+ 'textbox',
62
+ ],
63
+ },
64
+ ],
65
+ 'styled-components-a11y/label-has-associated-control': 'error',
66
+ 'styled-components-a11y/label-has-for': 'error',
67
+ 'styled-components-a11y/media-has-caption': 'error',
68
+ 'styled-components-a11y/mouse-events-have-key-events': 'error',
69
+ 'styled-components-a11y/no-access-key': 'error',
70
+ 'styled-components-a11y/no-autofocus': 'error',
71
+ 'styled-components-a11y/no-distracting-elements': 'error',
72
+ 'styled-components-a11y/no-interactive-element-to-noninteractive-role': 'error',
73
+ 'styled-components-a11y/no-noninteractive-element-interactions': [
74
+ 'error',
75
+ {
76
+ body: ['onError', 'onLoad'],
77
+ iframe: ['onError', 'onLoad'],
78
+ img: ['onError', 'onLoad'],
79
+ },
80
+ ],
81
+ 'styled-components-a11y/no-noninteractive-element-to-interactive-role': 'error',
82
+ 'styled-components-a11y/no-noninteractive-tabindex': 'error',
83
+ 'styled-components-a11y/no-onchange': 'error',
84
+ 'styled-components-a11y/no-redundant-roles': 'error',
85
+ 'styled-components-a11y/no-static-element-interactions': 'error',
86
+ 'styled-components-a11y/role-has-required-aria-props': 'error',
87
+ 'styled-components-a11y/role-supports-aria-props': 'error',
88
+ 'styled-components-a11y/scope': 'error',
89
+ 'styled-components-a11y/tabindex-no-positive': 'error',
90
+ },
8
91
  };
@@ -3,56 +3,60 @@
3
3
  // see: https://github.com/testing-library/eslint-plugin-jest-dom#supported-rules
4
4
 
5
5
  module.exports = {
6
- 'testing-library/await-async-query': 'error',
7
- 'testing-library/await-async-utils': 'error',
8
- 'testing-library/await-fire-event': 'off', // vue only
9
- 'testing-library/consistent-data-testid': [
10
- 'error',
11
- {
12
- // should we have an opinion about this?
13
- testIdPattern: '.*',
14
- testIdAttribute: ['data-testid'],
15
- },
16
- ],
17
- // since `user-event` v14 all its methods are async so we disable reporting them
18
- // by setting the `eventModules` to just `"fire-event"`
19
- 'testing-library/no-await-sync-events': [
20
- 'error',
21
- {
22
- eventModules: ['fire-event'],
23
- },
24
- ],
25
- 'testing-library/no-await-sync-query': 'error',
26
- 'testing-library/no-container': 'error',
27
- 'testing-library/no-debugging-utils': 'error',
28
- 'testing-library/no-dom-import': 'error',
29
- 'testing-library/no-manual-cleanup': 'error',
30
- 'testing-library/no-node-access': 'error',
31
- 'testing-library/no-promise-in-fire-event': 'error',
32
- 'testing-library/no-render-in-setup': 'error',
33
- 'testing-library/no-unnecessary-act': 'error',
34
- 'testing-library/no-wait-for-empty-callback': 'error',
35
- 'testing-library/no-wait-for-multiple-assertions': 'error',
36
- 'testing-library/no-wait-for-side-effects': 'error',
37
- 'testing-library/no-wait-for-snapshot': 'error',
38
- 'testing-library/prefer-explicit-assert': 'error',
39
- 'testing-library/prefer-find-by': 'error',
40
- 'testing-library/prefer-presence-queries': 'error',
41
- 'testing-library/prefer-query-by-disappearance': 'error',
42
- 'testing-library/prefer-screen-queries': 'error',
43
- 'testing-library/prefer-user-event': 'error',
44
- 'testing-library/prefer-wait-for': 'error',
45
- 'testing-library/render-result-naming-convention': 'error',
6
+ plugins: ['eslint-plugin-testing-library', 'eslint-plugin-jest-dom'],
46
7
 
47
- 'jest-dom/prefer-checked': 'error',
48
- 'jest-dom/prefer-empty': 'error',
49
- 'jest-dom/prefer-enabled-disabled': 'error',
50
- 'jest-dom/prefer-focus': 'error',
51
- 'jest-dom/prefer-in-document': 'error',
52
- 'jest-dom/prefer-required': 'error',
53
- 'jest-dom/prefer-to-have-attribute': 'error',
54
- 'jest-dom/prefer-to-have-class': 'error',
55
- 'jest-dom/prefer-to-have-style': 'error',
56
- 'jest-dom/prefer-to-have-text-content': 'error',
57
- 'jest-dom/prefer-to-have-value': 'error',
8
+ rules: {
9
+ 'testing-library/await-async-query': 'error',
10
+ 'testing-library/await-async-utils': 'error',
11
+ 'testing-library/await-fire-event': 'off', // vue only
12
+ 'testing-library/consistent-data-testid': [
13
+ 'error',
14
+ {
15
+ // should we have an opinion about this?
16
+ testIdPattern: '.*',
17
+ testIdAttribute: ['data-testid'],
18
+ },
19
+ ],
20
+ // since `user-event` v14 all its methods are async so we disable reporting them
21
+ // by setting the `eventModules` to just `"fire-event"`
22
+ 'testing-library/no-await-sync-events': [
23
+ 'error',
24
+ {
25
+ eventModules: ['fire-event'],
26
+ },
27
+ ],
28
+ 'testing-library/no-await-sync-query': 'error',
29
+ 'testing-library/no-container': 'error',
30
+ 'testing-library/no-debugging-utils': 'error',
31
+ 'testing-library/no-dom-import': 'error',
32
+ 'testing-library/no-manual-cleanup': 'error',
33
+ 'testing-library/no-node-access': 'error',
34
+ 'testing-library/no-promise-in-fire-event': 'error',
35
+ 'testing-library/no-render-in-setup': 'error',
36
+ 'testing-library/no-unnecessary-act': 'error',
37
+ 'testing-library/no-wait-for-empty-callback': 'error',
38
+ 'testing-library/no-wait-for-multiple-assertions': 'error',
39
+ 'testing-library/no-wait-for-side-effects': 'error',
40
+ 'testing-library/no-wait-for-snapshot': 'error',
41
+ 'testing-library/prefer-explicit-assert': 'error',
42
+ 'testing-library/prefer-find-by': 'error',
43
+ 'testing-library/prefer-presence-queries': 'error',
44
+ 'testing-library/prefer-query-by-disappearance': 'error',
45
+ 'testing-library/prefer-screen-queries': 'error',
46
+ 'testing-library/prefer-user-event': 'error',
47
+ 'testing-library/prefer-wait-for': 'error',
48
+ 'testing-library/render-result-naming-convention': 'error',
49
+
50
+ 'jest-dom/prefer-checked': 'error',
51
+ 'jest-dom/prefer-empty': 'error',
52
+ 'jest-dom/prefer-enabled-disabled': 'error',
53
+ 'jest-dom/prefer-focus': 'error',
54
+ 'jest-dom/prefer-in-document': 'error',
55
+ 'jest-dom/prefer-required': 'error',
56
+ 'jest-dom/prefer-to-have-attribute': 'error',
57
+ 'jest-dom/prefer-to-have-class': 'error',
58
+ 'jest-dom/prefer-to-have-style': 'error',
59
+ 'jest-dom/prefer-to-have-text-content': 'error',
60
+ 'jest-dom/prefer-to-have-value': 'error',
61
+ },
58
62
  };
@@ -1,33 +1,35 @@
1
1
  // only add rules pertaining to scss
2
2
 
3
3
  module.exports = {
4
- // disallow vendor prefixes
5
- 'at-rule-no-vendor-prefix': true,
6
- 'property-no-vendor-prefix': true,
7
- 'selector-no-vendor-prefix': true,
8
- 'value-no-vendor-prefix': true,
4
+ rules: {
5
+ // disallow vendor prefixes
6
+ 'at-rule-no-vendor-prefix': true,
7
+ 'property-no-vendor-prefix': true,
8
+ 'selector-no-vendor-prefix': true,
9
+ 'value-no-vendor-prefix': true,
9
10
 
10
- // prefer single to double quotes for better js compat
11
- 'string-quotes': 'single',
11
+ // prefer single to double quotes for better js compat
12
+ 'string-quotes': 'single',
12
13
 
13
- // *** DISABLED RULES ***
14
- // too many violations to fix so we just allow any pattern
15
- 'selector-class-pattern': '[a-zA-Z0-9]',
16
- 'selector-id-pattern': '[a-zA-Z0-9]',
14
+ // *** DISABLED RULES ***
15
+ // too many violations to fix so we just allow any pattern
16
+ 'selector-class-pattern': '[a-zA-Z0-9]',
17
+ 'selector-id-pattern': '[a-zA-Z0-9]',
17
18
 
18
- // unfortunately these conflict with sass functions; hopefully someday we will be able to enable
19
- 'color-function-notation': null,
20
- 'alpha-value-notation': null,
19
+ // unfortunately these conflict with sass functions; hopefully someday we will be able to enable
20
+ 'color-function-notation': null,
21
+ 'alpha-value-notation': null,
21
22
 
22
- // thousands of these errors, not realistically fixable
23
- 'no-descending-specificity': null,
23
+ // thousands of these errors, not realistically fixable
24
+ 'no-descending-specificity': null,
24
25
 
25
- // TODO: enable this?
26
- 'no-duplicate-selectors': null,
26
+ // TODO: enable this?
27
+ 'no-duplicate-selectors': null,
27
28
 
28
- 'scss/at-extend-no-missing-placeholder': null,
29
- 'scss/at-mixin-pattern': null,
30
- 'scss/dollar-variable-pattern': null,
31
- 'scss/no-global-function-names': null,
32
- 'scss/percent-placeholder-pattern': null,
29
+ 'scss/at-extend-no-missing-placeholder': null,
30
+ 'scss/at-mixin-pattern': null,
31
+ 'scss/dollar-variable-pattern': null,
32
+ 'scss/no-global-function-names': null,
33
+ 'scss/percent-placeholder-pattern': null,
34
+ },
33
35
  };
@@ -1,26 +1,30 @@
1
1
  // only add rules pertaining to styled-components
2
2
 
3
3
  module.exports = {
4
- // in css-in-js when variables are being passed around, this rule
5
- // often leads to less readable code, even though it is more compact
6
- 'declaration-block-no-redundant-longhand-properties': null,
7
- // this appears to conflict with styled-components keyframes method
8
- 'keyframes-name-pattern': null,
9
- // without this pretty much every file will throw an error¯\_(ツ)_/¯
10
- 'no-empty-source': null,
11
- // disallow property values that are ignored due to another property value in the same rule
12
- 'plugin/declaration-block-no-ignored-properties': true,
13
- // prevent snake case from being used for class/id selectors but be otherwise flexible
14
- 'selector-class-pattern': '^[a-zA-Z0-9-]+(-[a-zA-Z0-9]+)*$',
15
- 'selector-id-pattern': '^[a-zA-Z0-9-]+(-[a-zA-Z0-9]+)*$',
16
- // these selectors are used as placeholders by styled-components preprocessor
17
- 'selector-type-case': ['lower', { ignoreTypes: ['$dummyValue'] }],
18
- 'selector-type-no-unknown': [true, { ignoreTypes: ['$dummyValue', '/^-styled-/'] }],
19
- 'value-keyword-case': [
20
- 'lower',
21
- { ignoreKeywords: [/dummyValue/], ignoreProperties: [/dummyValue/] },
22
- ],
23
- // styled-components adds vendor prefixes if necessary so we should avoid adding them in code
24
- 'value-no-vendor-prefix': true,
25
- 'property-no-vendor-prefix': true,
4
+ plugins: ['eslint-plugin-better-styled-components', 'eslint-plugin-styled-components-a11y'],
5
+
6
+ rules: {
7
+ // in css-in-js when variables are being passed around, this rule
8
+ // often leads to less readable code, even though it is more compact
9
+ 'declaration-block-no-redundant-longhand-properties': null,
10
+ // this appears to conflict with styled-components keyframes method
11
+ 'keyframes-name-pattern': null,
12
+ // without this pretty much every file will throw an error¯\_(ツ)_/¯
13
+ 'no-empty-source': null,
14
+ // disallow property values that are ignored due to another property value in the same rule
15
+ 'plugin/declaration-block-no-ignored-properties': true,
16
+ // prevent snake case from being used for class/id selectors but be otherwise flexible
17
+ 'selector-class-pattern': '^[a-zA-Z0-9-]+(-[a-zA-Z0-9]+)*$',
18
+ 'selector-id-pattern': '^[a-zA-Z0-9-]+(-[a-zA-Z0-9]+)*$',
19
+ // these selectors are used as placeholders by styled-components preprocessor
20
+ 'selector-type-case': ['lower', { ignoreTypes: ['$dummyValue'] }],
21
+ 'selector-type-no-unknown': [true, { ignoreTypes: ['$dummyValue', '/^-styled-/'] }],
22
+ 'value-keyword-case': [
23
+ 'lower',
24
+ { ignoreKeywords: [/dummyValue/], ignoreProperties: [/dummyValue/] },
25
+ ],
26
+ // styled-components adds vendor prefixes if necessary so we should avoid adding them in code
27
+ 'value-no-vendor-prefix': true,
28
+ 'property-no-vendor-prefix': true,
29
+ },
26
30
  };
package/sonar.js CHANGED
@@ -1,8 +1,3 @@
1
- const sonarRules = require('./rules/eslint/sonar');
2
-
3
1
  module.exports = {
4
- plugins: ['eslint-plugin-sonarjs'],
5
- rules: {
6
- ...sonarRules,
7
- },
2
+ extends: ['./rules/eslint/sonar'].map(require.resolve),
8
3
  };
@@ -1,9 +1,3 @@
1
- const styledComponentsRules = require('./rules/eslint/styled-components');
2
-
3
1
  module.exports = {
4
- plugins: ['eslint-plugin-better-styled-components', 'eslint-plugin-styled-components-a11y'],
5
- extends: ['plugin:styled-components-a11y/strict'],
6
- rules: {
7
- ...styledComponentsRules,
8
- },
2
+ extends: ['./rules/eslint/styled-components'].map(require.resolve),
9
3
  };
package/stylelint/base.js CHANGED
@@ -1,9 +1,8 @@
1
- const commonRules = require('../rules/stylelint/common');
2
-
3
1
  module.exports = {
4
2
  plugins: ['stylelint-prettier'],
5
- extends: ['stylelint-config-standard', 'stylelint-config-prettier'],
3
+ extends: ['stylelint-config-standard', 'stylelint-config-prettier'].map(require.resolve),
6
4
  rules: {
7
- ...commonRules,
5
+ // prettier configuration
6
+ 'prettier/prettier': true,
8
7
  },
9
8
  };
package/stylelint/scss.js CHANGED
@@ -1,11 +1,10 @@
1
- const commonRules = require('../rules/stylelint/common');
2
- const scssRules = require('../rules/stylelint/scss');
1
+ // see: https://github.com/stylelint-scss/stylelint-config-standard-scss/blob/main/index.js
3
2
 
4
3
  module.exports = {
5
4
  plugins: ['stylelint-prettier', 'eslint-plugin-stylelint-scss'],
6
- extends: ['stylelint-config-standard-scss'], // see: https://github.com/stylelint-scss/stylelint-config-standard-scss/blob/main/index.js
5
+ extends: ['stylelint-config-standard-scss', '../rules/stylelint/scss'].map(require.resolve),
7
6
  rules: {
8
- ...commonRules,
9
- ...scssRules,
7
+ // prettier configuration
8
+ 'prettier/prettier': true,
10
9
  },
11
10
  };
@@ -1,13 +1,14 @@
1
- const commonRules = require('../rules/stylelint/common');
2
- const styledComponentRules = require('../rules/stylelint/styled-components');
3
-
4
1
  module.exports = {
5
2
  plugins: ['stylelint-prettier', 'stylelint-declaration-block-no-ignored-properties'],
6
- extends: ['stylelint-config-standard-scss', 'stylelint-config-prettier'],
3
+ extends: [
4
+ 'stylelint-config-standard-scss',
5
+ '../rules/stylelint/styled-components',
6
+ 'stylelint-config-prettier',
7
+ ].map(require.resolve),
7
8
  customSyntax: 'postcss-scss',
8
9
  processors: ['stylelint-processor-styled-components'],
9
10
  rules: {
10
- ...commonRules,
11
- ...styledComponentRules,
11
+ // prettier configuration
12
+ 'prettier/prettier': true,
12
13
  },
13
14
  };
@@ -1,8 +1,3 @@
1
- const testRules = require('./rules/eslint/testing-library');
2
-
3
1
  module.exports = {
4
- plugins: ['eslint-plugin-testing-library', 'eslint-plugin-jest-dom'],
5
- rules: {
6
- ...testRules,
7
- },
2
+ extends: ['./rules/eslint/testing-library'].map(require.resolve),
8
3
  };
@@ -1,6 +0,0 @@
1
- // these rules are included in all config types
2
-
3
- module.exports = {
4
- // prettier configuration
5
- 'prettier/prettier': true,
6
- };