@darksheep/eslint 4.1.3

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.
Files changed (40) hide show
  1. package/CHANGELOG.md +737 -0
  2. package/LICENSE +24 -0
  3. package/README.md +34 -0
  4. package/package.json +62 -0
  5. package/src/bin/eslint.cjs +11 -0
  6. package/src/configs/eslint-base.js +124 -0
  7. package/src/configs/eslint-complexity.js +28 -0
  8. package/src/configs/eslint-ignores.js +51 -0
  9. package/src/configs/eslint-recommended.js +9 -0
  10. package/src/configs/eslint-style.js +23 -0
  11. package/src/custom/index.js +11 -0
  12. package/src/custom/instance-of-array.js +72 -0
  13. package/src/custom/loose-types.js +204 -0
  14. package/src/custom/no-useless-expression.js +28 -0
  15. package/src/custom/sequence-expression.js +21 -0
  16. package/src/index.js +86 -0
  17. package/src/plugins/eslint-comments.js +27 -0
  18. package/src/plugins/import.js +139 -0
  19. package/src/plugins/jest.js +124 -0
  20. package/src/plugins/jsdoc.js +70 -0
  21. package/src/plugins/json.js +37 -0
  22. package/src/plugins/jsx-a11y.js +100 -0
  23. package/src/plugins/node.js +129 -0
  24. package/src/plugins/promise.js +16 -0
  25. package/src/plugins/react.js +128 -0
  26. package/src/plugins/regexp.js +13 -0
  27. package/src/plugins/sca.js +41 -0
  28. package/src/plugins/security.js +15 -0
  29. package/src/plugins/sonarjs.js +28 -0
  30. package/src/plugins/style.js +249 -0
  31. package/src/plugins/typescript.js +87 -0
  32. package/src/plugins/unicorn.js +58 -0
  33. package/src/plugins/unused-imports.js +52 -0
  34. package/src/types.d.ts +118 -0
  35. package/src/utilities/editorconfig.js +210 -0
  36. package/src/utilities/eslint-files.js +65 -0
  37. package/src/utilities/expand-glob.js +49 -0
  38. package/src/utilities/filesystem.js +73 -0
  39. package/src/utilities/make-compat.js +17 -0
  40. package/src/utilities/package.js +49 -0
@@ -0,0 +1,129 @@
1
+ import { fileURLToPath } from 'node:url';
2
+ import { dirname } from 'node:path';
3
+
4
+ import n from 'eslint-plugin-n';
5
+ import {
6
+ getCommonFiles,
7
+ getModuleFiles,
8
+ getTypescriptFiles,
9
+ getExampleFiles,
10
+ } from '../utilities/eslint-files.js';
11
+
12
+ const script = n.configs['flat/recommended-script'];
13
+ const module = n.configs['flat/recommended-module'];
14
+
15
+ /** @type {import('eslint').Linter.RulesRecord} */
16
+ const commonRules = {
17
+ 'n/no-new-require': 'error',
18
+ 'n/no-mixed-requires': 'error',
19
+
20
+ 'n/callback-return': 'error',
21
+ 'n/handle-callback-err': 'error',
22
+ 'n/no-process-exit': 'warn',
23
+ 'n/no-path-concat': 'error',
24
+
25
+ 'n/no-callback-literal': 'off',
26
+ 'n/no-exports-assign': 'off',
27
+
28
+ 'n/global-require': [ 'error' ],
29
+ 'n/no-unpublished-bin': 'error',
30
+ 'n/no-unpublished-import': [ 'error', { ignoreTypeImport: true } ],
31
+ 'n/no-unpublished-require': 'error',
32
+
33
+ 'n/no-unsupported-features/es-builtins': 'error',
34
+ 'n/no-unsupported-features/es-syntax': [ 'error', { ignores: [ 'modules' ] } ],
35
+ 'n/no-unsupported-features/node-builtins': 'error',
36
+
37
+ 'n/process-exit-as-throw': 'error',
38
+ 'n/shebang': 'error',
39
+
40
+ 'n/no-deprecated-api': 'error',
41
+
42
+ 'n/exports-style': [ 'error', 'module.exports' ],
43
+ 'n/file-extension-in-import': [ 'error', 'always' ],
44
+
45
+ 'n/prefer-global/buffer': [ 'warn', 'always' ],
46
+ 'n/prefer-global/console': [ 'warn', 'always' ],
47
+ 'n/prefer-global/process': [ 'warn', 'always' ],
48
+ 'n/prefer-global/text-decoder': [ 'warn', 'never' ],
49
+ 'n/prefer-global/text-encoder': [ 'warn', 'never' ],
50
+ 'n/prefer-global/url-search-params': [ 'warn', 'never' ],
51
+ 'n/prefer-global/url': [ 'warn', 'never' ],
52
+ 'n/prefer-promises/dns': 'warn',
53
+ 'n/prefer-promises/fs': 'warn',
54
+ };
55
+
56
+ /**
57
+ * @param {string[]} globs A list of file globs whos extensions to get
58
+ * @returns {string[]}
59
+ */
60
+ function toExt(globs) {
61
+ return globs.map((glob) => glob.slice(glob.lastIndexOf('.')));
62
+ }
63
+
64
+ /**
65
+ * Get ESLint config for the node plugin
66
+ * @param {URL} root root url
67
+ * @returns {Promise<import('eslint').Linter.FlatConfig[]>}
68
+ */
69
+ export async function createEslintNodeConfigs(root) {
70
+ const commonFiles = await getCommonFiles(root);
71
+ const moduleFiles = await getModuleFiles(root);
72
+ const typescriptFiles = await getTypescriptFiles();
73
+ const exampleFiles = await getExampleFiles();
74
+ const rootDirectory = dirname(fileURLToPath(root));
75
+
76
+ return [
77
+ {
78
+ files: commonFiles,
79
+ ignores: exampleFiles,
80
+ plugins: { n },
81
+ languageOptions: {
82
+ globals: script?.languageOptions?.globals,
83
+ parserOptions: {
84
+ sourceType: 'script',
85
+ ecmaVersion: 2022,
86
+ },
87
+ },
88
+ settings: {
89
+ node: {
90
+ tryExtensions: toExt(commonFiles),
91
+ resolvePaths: rootDirectory,
92
+ },
93
+ },
94
+ rules: {
95
+ ...commonRules,
96
+ 'n/no-sync': [ 'error', { allowAtRootLevel: true } ],
97
+ 'n/no-extraneous-require': 'error',
98
+ 'n/no-missing-require': 'error',
99
+
100
+ 'n/no-unsupported-features/es-syntax': [ 'error', { ignores: [] } ],
101
+ },
102
+ },
103
+ {
104
+ files: [ ...typescriptFiles, ...moduleFiles ],
105
+ ignores: exampleFiles,
106
+ plugins: { n },
107
+ languageOptions: {
108
+ globals: module?.languageOptions?.globals,
109
+ parserOptions: {
110
+ sourceType: 'module',
111
+ ecmaVersion: 2022,
112
+ },
113
+ },
114
+ settings: {
115
+ node: {
116
+ tryExtensions: toExt([ ...typescriptFiles, ...moduleFiles ]),
117
+ resolvePaths: rootDirectory,
118
+ },
119
+ },
120
+ rules: {
121
+ ...commonRules,
122
+ 'n/no-extraneous-import': 'error',
123
+ 'n/no-missing-import': 'error',
124
+ 'n/no-sync': [ 'error', { allowAtRootLevel: false } ],
125
+ 'n/no-unsupported-features/es-syntax': [ 'error', { ignores: [ 'modules' ] } ],
126
+ },
127
+ },
128
+ ];
129
+ }
@@ -0,0 +1,16 @@
1
+ import promise from 'eslint-plugin-promise';
2
+
3
+ /**
4
+ * Get ESLint config for the promise plugin
5
+ * @returns {import('eslint').Linter.FlatConfig[]}
6
+ */
7
+ export function createEslintPromiseConfig() {
8
+ return [ {
9
+ plugins: { promise },
10
+ rules: {
11
+ ...promise.configs.recommended.rules,
12
+ 'promise/catch-or-return': [ 'error', { allowFinally: true } ],
13
+ 'promise/no-return-wrap': [ 'error', { allowReject: true } ],
14
+ },
15
+ } ];
16
+ }
@@ -0,0 +1,128 @@
1
+ import react from 'eslint-plugin-react';
2
+
3
+ import { getPackageJson } from '../utilities/package.js';
4
+
5
+ /** @type {import('eslint').Linter.RulesRecord} */
6
+ const rules = {
7
+ 'react/display-name': 2,
8
+ 'react/jsx-key': 2,
9
+ 'react/jsx-no-comment-textnodes': 2,
10
+ 'react/jsx-no-duplicate-props': 2,
11
+ 'react/jsx-no-target-blank': 2,
12
+ 'react/jsx-no-undef': 2,
13
+ 'react/jsx-uses-react': 2,
14
+ 'react/jsx-uses-vars': 2,
15
+ 'react/no-children-prop': 2,
16
+ 'react/no-danger-with-children': 2,
17
+ 'react/no-deprecated': 2,
18
+ 'react/no-direct-mutation-state': 2,
19
+ 'react/no-find-dom-node': 2,
20
+ 'react/no-is-mounted': 2,
21
+ 'react/no-render-return-value': 2,
22
+ 'react/no-string-refs': 2,
23
+ 'react/no-unescaped-entities': 2,
24
+ 'react/no-unknown-property': 2,
25
+ 'react/no-unsafe': 0,
26
+ 'react/prop-types': 2,
27
+ 'react/react-in-jsx-scope': 2,
28
+ 'react/require-render-return': 2,
29
+
30
+ 'react/boolean-prop-naming': 0,
31
+ 'react/button-has-type': 0,
32
+ 'react/default-props-match-prop-types': 0,
33
+ 'react/destructuring-assignment': 0,
34
+ 'react/forbid-component-props': 0,
35
+ 'react/forbid-dom-props': 0,
36
+ 'react/forbid-elements': 0,
37
+ 'react/forbid-foreign-prop-types': 0,
38
+ 'react/forbid-prop-types': 0,
39
+ 'react/function-component-definition': 0,
40
+ 'react/hook-use-state': 0,
41
+ 'react/iframe-missing-sandbox': 0,
42
+ 'react/jsx-boolean-value': 0,
43
+ 'react/jsx-filename-extension': 0,
44
+ 'react/jsx-handler-names': 0,
45
+ 'react/jsx-max-depth': 0,
46
+ 'react/jsx-no-bind': 0,
47
+ 'react/jsx-no-constructed-context-values': 0,
48
+ 'react/jsx-no-leaked-render': 0,
49
+ 'react/jsx-no-literals': 0,
50
+ 'react/jsx-no-script-url': 0,
51
+ 'react/jsx-no-useless-fragment': 0,
52
+ 'react/jsx-pascal-case': 0,
53
+ 'react/jsx-fragments': 0,
54
+ 'react/jsx-props-no-spreading': 0,
55
+ 'react/no-invalid-html-attribute': 0,
56
+ 'react/no-access-state-in-setstate': 0,
57
+ 'react/no-adjacent-inline-elements': 0,
58
+ 'react/no-array-index-key': 0,
59
+ 'react/no-arrow-function-lifecycle': 0,
60
+ 'react/no-danger': 0,
61
+ 'react/no-did-mount-set-state': 0,
62
+ 'react/no-did-update-set-state': 0,
63
+ 'react/no-multi-comp': 0,
64
+ 'react/no-namespace': 0,
65
+ 'react/no-set-state': 0,
66
+ 'react/no-redundant-should-component-update': 0,
67
+ 'react/no-this-in-sfc': 0,
68
+ 'react/no-typos': 0,
69
+ 'react/no-unstable-nested-components': 0,
70
+ 'react/no-unused-class-component-methods': 0,
71
+ 'react/no-unused-prop-types': 0,
72
+ 'react/no-unused-state': 0,
73
+ 'react/no-object-type-as-default-prop': 0,
74
+ 'react/no-will-update-set-state': 0,
75
+ 'react/prefer-es6-class': 0,
76
+ 'react/prefer-exact-props': 0,
77
+ 'react/prefer-read-only-props': 0,
78
+ 'react/prefer-stateless-function': 0,
79
+ 'react/require-default-props': 0,
80
+ 'react/require-optimization': 0,
81
+ 'react/self-closing-comp': 0,
82
+ 'react/sort-comp': 0,
83
+ 'react/sort-default-props': 0,
84
+ 'react/sort-prop-types': 0,
85
+ 'react/state-in-constructor': 0,
86
+ 'react/static-property-placement': 0,
87
+ 'react/style-prop-object': 0,
88
+ 'react/void-dom-elements-no-children': 0,
89
+ };
90
+
91
+ /**
92
+ * Get ESLint config for imports check
93
+ * @param {URL} root The root of the package being linted
94
+ * @returns {Promise<import('eslint').Linter.FlatConfig[]>}
95
+ */
96
+ export async function createEslintReactConfig(root) {
97
+ const packageJson = await getPackageJson(root, 'react');
98
+
99
+ return [
100
+ {
101
+ files: [ '**/*.jsx' ],
102
+ languageOptions: {
103
+ parserOptions: {
104
+ ecmaFeatures: { jsx: true },
105
+ },
106
+ },
107
+ settings: {
108
+ react: { version: packageJson?.version },
109
+ },
110
+ plugins: { react },
111
+ rules: rules,
112
+ },
113
+ {
114
+ files: [ '**/*.tsx' ],
115
+ languageOptions: {
116
+ parserOptions: {
117
+ ecmaFeatures: { jsx: true },
118
+ jsxPragma: null,
119
+ },
120
+ },
121
+ settings: {
122
+ react: { version: packageJson?.version },
123
+ },
124
+ plugins: { react },
125
+ rules: rules,
126
+ },
127
+ ];
128
+ }
@@ -0,0 +1,13 @@
1
+ import { makeCompat } from '../utilities/make-compat.js';
2
+
3
+ /**
4
+ * Get ESLint config for the regexp plugin
5
+ * @param {import('node:url').URL} root root url
6
+ * @returns {import('eslint').Linter.FlatConfig[]}
7
+ */
8
+ export function createEslintRegexpConfig(root) {
9
+ return makeCompat(root).config({
10
+ plugins: [ 'regexp' ],
11
+ extends: [ 'plugin:regexp/recommended' ],
12
+ });
13
+ }
@@ -0,0 +1,41 @@
1
+ import sca from '../custom/index.js';
2
+ import {
3
+ getCommonFiles,
4
+ getModuleFiles,
5
+ getTypescriptFiles,
6
+ } from '../utilities/eslint-files.js';
7
+
8
+ /**
9
+ * Get ESLint config for the sca plugin
10
+ * @param {URL} root The root url of the package we are linting
11
+ * @returns {Promise<import('eslint').Linter.FlatConfig[]>}
12
+ */
13
+ export async function createEslintSCAConfig(root) {
14
+ return [
15
+ {
16
+ files: [
17
+ ...await getCommonFiles(root),
18
+ ...await getModuleFiles(root),
19
+ ],
20
+ plugins: { sca },
21
+ rules: {
22
+ 'sca/loose-types': [
23
+ 'error',
24
+ {
25
+ allowConditionalExpressionCallExpression: true,
26
+ allowLogicalExpressionCallExpression: true,
27
+ },
28
+ ],
29
+ 'sca/no-useless-expression': 'error',
30
+ 'sca/sequence-expression': 'error',
31
+ },
32
+ },
33
+ {
34
+ files: await getTypescriptFiles(),
35
+ plugins: { sca },
36
+ rules: {
37
+ 'sca/sequence-expression': 'error',
38
+ },
39
+ },
40
+ ];
41
+ }
@@ -0,0 +1,15 @@
1
+ import security from 'eslint-plugin-security';
2
+
3
+ /**
4
+ * Get ESLint config for the security plugin
5
+ * @returns {import('eslint').Linter.FlatConfig[]}
6
+ */
7
+ export function createEslintSecurityConfig() {
8
+ return [ {
9
+ ...security.configs.recommended,
10
+ plugins: { security },
11
+ rules: {
12
+ 'security/detect-non-literal-fs-filename': 0,
13
+ },
14
+ } ];
15
+ }
@@ -0,0 +1,28 @@
1
+ import eslintSonarJS from 'eslint-plugin-sonarjs';
2
+ import { makeCompat } from '../utilities/make-compat.js';
3
+
4
+ /**
5
+ * Get ESLint config for the sonar plugin
6
+ * @param {import('node:url').URL} root root url
7
+ * @returns {import('eslint').Linter.FlatConfig[]}
8
+ */
9
+ export function createEslintSonarJSConfig(root) {
10
+ return makeCompat(root).config({
11
+ plugins: [
12
+ 'sonarjs',
13
+ ],
14
+ rules: {
15
+ ...eslintSonarJS.configs.recommended.rules,
16
+ 'sonarjs/cognitive-complexity': 'error',
17
+ },
18
+ extends: [ 'plugin:sonarjs/recommended' ],
19
+ overrides: [
20
+ {
21
+ files: [ '*.test.*' ],
22
+ rules: {
23
+ 'sonarjs/no-duplicate-string': 'off',
24
+ },
25
+ },
26
+ ],
27
+ });
28
+ }
@@ -0,0 +1,249 @@
1
+ /* eslint max-lines-per-function: 0 */
2
+ import stylistic from '@stylistic/eslint-plugin';
3
+
4
+ /**
5
+ * Get ESLint config for the sonar plugin
6
+ * @returns {import('eslint').Linter.FlatConfig[]}
7
+ */
8
+ export function createEslintStyleConfig() {
9
+ return [ {
10
+ plugins: { style: stylistic },
11
+ rules: {
12
+ // Require or disallow newline at the end of files
13
+ // 'style/eol-last': [ 'error' ],
14
+ // Enforce consistent indentation
15
+ // 'style/indent': [ 'error' ],
16
+ // Indentation for binary operators
17
+ // 'style/indent-binary-ops': [ 'error' ],
18
+ // Enforce consistent linebreak style
19
+ // 'style/linebreak-style': [ 'error' ],
20
+ // Disallow trailing whitespace at the end of lines
21
+ // 'style/no-trailing-spaces': [ 'error' ],
22
+ // Enforce JSX indentation
23
+ // 'style/jsx-indent': [ 'off' ],
24
+
25
+ // Enforce linebreaks after opening and before closing array brackets
26
+ 'style/array-bracket-newline': [ 'error', 'consistent' ],
27
+ // Enforce consistent spacing inside array brackets
28
+ 'style/array-bracket-spacing': [ 'error', 'always' ],
29
+ // Enforce line breaks after each array element
30
+ 'style/array-element-newline': [ 'error', 'consistent' ],
31
+ // Require parentheses around arrow function arguments
32
+ 'style/arrow-parens': [ 'error', 'always' ],
33
+ // Enforce consistent spacing before and after the arrow in arrow functions
34
+ 'style/arrow-spacing': [ 'error' ],
35
+ // Disallow or enforce spaces inside of blocks after opening block and before closing block
36
+ 'style/block-spacing': [ 'error' ],
37
+ // Enforce consistent brace style for blocks
38
+ 'style/brace-style': [ 'error', '1tbs' ],
39
+ // Require or disallow trailing commas
40
+ 'style/comma-dangle': [ 'error', 'always-multiline' ],
41
+ // Enforce consistent spacing before and after commas
42
+ 'style/comma-spacing': [ 'error', { before: false, after: true } ],
43
+ // Enforce consistent comma style
44
+ 'style/comma-style': [ 'error', 'last' ],
45
+ // Enforce consistent spacing inside computed property brackets
46
+ 'style/computed-property-spacing': [ 'error', 'never' ],
47
+ // Enforce consistent newlines before and after dots
48
+ 'style/dot-location': [ 'error', 'property' ],
49
+ // Require or disallow spacing between function identifiers and their invocations. Alias of `function-call-spacing`.
50
+ 'style/func-call-spacing': [ 'error', 'never' ],
51
+ // Enforce line breaks between arguments of a function call
52
+ 'style/function-call-argument-newline': [ 'error', 'consistent' ],
53
+ // Require or disallow spacing between function identifiers and their invocations
54
+ 'style/function-call-spacing': [ 'error' ],
55
+ // Enforce consistent line breaks inside function parentheses
56
+ 'style/function-paren-newline': [ 'error', 'consistent' ],
57
+ // Enforce consistent spacing around `*` operators in generator functions
58
+ 'style/generator-star-spacing': [ 'error', 'both' ],
59
+ // Enforce the location of arrow function bodies
60
+ 'style/implicit-arrow-linebreak': [ 'error', 'beside' ],
61
+ // Enforce the consistent use of either double or single quotes in JSX attributes
62
+ 'style/jsx-quotes': [ 'error' ],
63
+ // Enforce consistent spacing between keys and values in object literal properties
64
+ 'style/key-spacing': [ 'error', { beforeColon: false, afterColon: true } ],
65
+ // Enforce consistent spacing before and after keywords
66
+ 'style/keyword-spacing': [ 'error', { before: true, after: true } ],
67
+ // Require empty lines around comments
68
+ 'style/lines-around-comment': [ 'off' ],
69
+ // Require or disallow an empty line between class members
70
+ 'style/lines-between-class-members': [
71
+ 'error',
72
+ 'always',
73
+ { exceptAfterSingleLine: true },
74
+ ],
75
+ // Enforce a maximum line length
76
+ 'style/max-len': [ 'off' ],
77
+ // 'warn',
78
+ // {
79
+ // code: 100,
80
+ // ignoreComments: true,
81
+ // ignoreRegExpLiterals: true,
82
+ // ignoreStrings: true,
83
+ // ignoreTemplateLiterals: true,
84
+ // ignoreUrls: true,
85
+ // },
86
+ // ]
87
+ // Enforce a maximum number of statements allowed per line
88
+ 'style/max-statements-per-line': [ 'error' ],
89
+ // Enforce newlines between operands of ternary expressions
90
+ 'style/multiline-ternary': [ 'error', 'always-multiline' ],
91
+ // Enforce or disallow parentheses when invoking a constructor with no arguments
92
+ 'style/new-parens': [ 'error' ],
93
+ // Require a newline after each call in a method chain
94
+ 'style/newline-per-chained-call': [ 'error' ],
95
+ // Disallow arrow functions where they could be confused with comparisons
96
+ 'style/no-confusing-arrow': [ 'warn', { allowParens: true } ],
97
+ // Disallow unnecessary parentheses
98
+ 'style/no-extra-parens': [ 'off' ],
99
+ // Disallow unnecessary semicolons
100
+ 'style/no-extra-semi': [ 'error' ],
101
+ // Disallow leading or trailing decimal points in numeric literals
102
+ 'style/no-floating-decimal': [ 'error' ],
103
+ // Disallow mixed binary operators
104
+ 'style/no-mixed-operators': [ 'error' ],
105
+ // Disallow mixed spaces and tabs for indentation
106
+ 'style/no-mixed-spaces-and-tabs': [ 'error' ],
107
+ // Disallow multiple spaces
108
+ 'style/no-multi-spaces': [ 'error' ],
109
+ // Disallow multiple empty lines
110
+ 'style/no-multiple-empty-lines': [
111
+ 'error',
112
+ {
113
+ max: 1,
114
+ maxBOF: 1,
115
+ maxEOF: 1,
116
+ },
117
+ ],
118
+ // Disallow all tabs
119
+ 'style/no-tabs': [ 'error' ],
120
+ // Disallow whitespace before properties
121
+ 'style/no-whitespace-before-property': [ 'error' ],
122
+ // Enforce the location of single-line statements
123
+ 'style/nonblock-statement-body-position': [ 'error' ],
124
+ // Enforce consistent line breaks after opening and before closing braces
125
+ 'style/object-curly-newline': [ 'error', { consistent: true } ],
126
+ // Enforce consistent spacing inside braces
127
+ 'style/object-curly-spacing': [ 'error', 'always' ],
128
+ // Enforce placing object properties on separate lines
129
+ 'style/object-property-newline': [ 'error', { allowAllPropertiesOnSameLine: true } ],
130
+ // Require or disallow newlines around variable declarations
131
+ 'style/one-var-declaration-per-line': [ 'error', 'initializations' ],
132
+ // Enforce consistent linebreak style for operators
133
+ 'style/operator-linebreak': [
134
+ 'error',
135
+ 'after',
136
+ {
137
+ overrides: {
138
+ '?': 'before',
139
+ ':': 'before',
140
+ },
141
+ },
142
+ ],
143
+ // Require or disallow padding within blocks
144
+ 'style/padded-blocks': [ 'error', 'never' ],
145
+ // Require or disallow padding lines between statements
146
+ 'style/padding-line-between-statements': [ 'off' ],
147
+ // Require quotes around object literal property names
148
+ 'style/quote-props': [ 'error', 'consistent-as-needed' ],
149
+ // Enforce the consistent use of either backticks, double, or single quotes
150
+ 'style/quotes': [
151
+ 'error',
152
+ 'single',
153
+ {
154
+ allowTemplateLiterals: true,
155
+ avoidEscape: true,
156
+ },
157
+ ],
158
+ // Enforce spacing between rest and spread operators and their expressions
159
+ 'style/rest-spread-spacing': [ 'error', 'never' ],
160
+ // Require or disallow semicolons instead of ASI
161
+ 'style/semi': [ 'error', 'always' ],
162
+ // Enforce consistent spacing before and after semicolons
163
+ 'style/semi-spacing': [ 'error' ],
164
+ // Enforce location of semicolons
165
+ 'style/semi-style': [ 'error', 'last' ],
166
+ // Enforce consistent spacing before blocks
167
+ 'style/space-before-blocks': [ 'error' ],
168
+ // Enforce consistent spacing before `function` definition opening parenthesis
169
+ 'style/space-before-function-paren': [
170
+ 'error',
171
+ {
172
+ anonymous: 'always',
173
+ named: 'never',
174
+ asyncArrow: 'always',
175
+ },
176
+ ],
177
+ // Enforce consistent spacing inside parentheses
178
+ 'style/space-in-parens': [ 'error', 'never' ],
179
+ // Require spacing around infix operators
180
+ 'style/space-infix-ops': [ 'error' ],
181
+ // Enforce consistent spacing before or after unary operators
182
+ 'style/space-unary-ops': [ 'error' ],
183
+ // Enforce consistent spacing after the `//` or `/*` in a comment
184
+ 'style/spaced-comment': [ 'error', 'always', { markers: [ '?' ] } ],
185
+ // Enforce spacing around colons of switch statements
186
+ 'style/switch-colon-spacing': [ 'error' ],
187
+ // Require or disallow spacing around embedded expressions of template strings
188
+ 'style/template-curly-spacing': [ 'error' ],
189
+ // Require or disallow spacing between template tags and their literals
190
+ 'style/template-tag-spacing': [ 'error' ],
191
+ // Require parentheses around immediate `function` invocations
192
+ 'style/wrap-iife': [
193
+ 'error',
194
+ 'inside',
195
+ { functionPrototypeMethods: true },
196
+ ],
197
+ // Require parenthesis around regex literals
198
+ 'style/wrap-regex': [ 'error' ],
199
+ // Require or disallow spacing around the `*` in `yield*` expressions
200
+ 'style/yield-star-spacing': [ 'error', 'both' ],
201
+
202
+ // Require a specific member delimiter style for interfaces and type literals
203
+ 'style/member-delimiter-style': [ 'error' ],
204
+ // Require consistent spacing around type annotations
205
+ 'style/type-annotation-spacing': [ 'error' ],
206
+
207
+ // Enforce or disallow spaces inside of curly braces in JSX attributes and expressions
208
+ 'style/jsx-child-element-spacing': [ 'off' ],
209
+ // Enforce closing bracket location in JSX
210
+ 'style/jsx-closing-bracket-location': [ 'off' ],
211
+ // Enforce closing tag location for multiline JSX
212
+ 'style/jsx-closing-tag-location': [ 'off' ],
213
+ // Disallow unnecessary JSX expressions when literals alone are sufficient or enforce JSX expressions on literals in JSX children or attributes
214
+ 'style/jsx-curly-brace-presence': [ 'off' ],
215
+ // Enforce consistent linebreaks in curly braces in JSX attributes and expressions
216
+ 'style/jsx-curly-newline': [ 'off' ],
217
+ // Enforce or disallow spaces inside of curly braces in JSX attributes and expressions
218
+ 'style/jsx-curly-spacing': [ 'off' ],
219
+ // Enforce or disallow spaces around equal signs in JSX attributes
220
+ 'style/jsx-equals-spacing': [ 'off' ],
221
+ // Enforce proper position of the first property in JSX
222
+ 'style/jsx-first-prop-new-line': [ 'off' ],
223
+ // Enforce props indentation in JSX
224
+ 'style/jsx-indent-props': [ 'off' ],
225
+ // Enforce maximum of props on a single line in JSX
226
+ 'style/jsx-max-props-per-line': [ 'off' ],
227
+ // Require or prevent a new line after jsx elements and expressions.
228
+ 'style/jsx-newline': [ 'off' ],
229
+ // Require one JSX element per line
230
+ 'style/jsx-one-expression-per-line': [ 'off' ],
231
+ // Disallow multiple spaces between inline JSX props
232
+ 'style/jsx-props-no-multi-spaces': [ 'off' ],
233
+ // Disallow extra closing tags for components without children
234
+ 'style/jsx-self-closing-comp': [ 'off' ],
235
+ // Enforce props alphabetical sorting
236
+ 'style/jsx-sort-props': [ 'off' ],
237
+ // Enforce whitespace in and around the JSX opening and closing brackets
238
+ 'style/jsx-tag-spacing': [ 'off' ],
239
+ // Disallow missing parentheses around multiline JSX
240
+ 'style/jsx-wrap-multilines': [ 'off' ],
241
+
242
+ // Enforces consistent spacing inside TypeScript type generics
243
+ 'style/type-generic-spacing': [ 'error' ],
244
+ // Expect space before the type declaration in the named tuple
245
+ 'style/type-named-tuple-spacing': [ 'error' ],
246
+
247
+ },
248
+ } ];
249
+ }