@jakubmazanec/eslint-config 2.0.0-next.8fca4dc → 2.0.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.
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2022 Jakub Mazanec
3
+ Copyright (c) 2023 Jakub Mazanec
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
6
6
  associated documentation files (the "Software"), to deal in the Software without restriction,
package/README.md ADDED
@@ -0,0 +1,34 @@
1
+ <div align="center">
2
+
3
+ # @jakubmazanec/eslint-config
4
+
5
+ ESLint config for TypeScript projects.
6
+
7
+ </div>
8
+
9
+ ## Installation
10
+
11
+ ```sh
12
+ npm install @jakubmazanec/eslint-config
13
+ ```
14
+
15
+ #### Prerequisites
16
+
17
+ - Node.js 16 or later
18
+ - TypeScript 5 or later
19
+
20
+ ## Usage
21
+
22
+ 🚧 This section is under development. Please check back later for updates.
23
+
24
+ ## Documentation
25
+
26
+ See [API reference](./docs) for auto-generated documentation.
27
+
28
+ ## Contributing
29
+
30
+ If you want to contribute, see [CONTRIBUTING](./CONTRIBUTING.md) for details.
31
+
32
+ ## License
33
+
34
+ This package is licensed under the MIT license. See [LICENSE](./LICENSE.md) for details.
package/dist/constants.js CHANGED
@@ -16,19 +16,19 @@ _export(exports, {
16
16
  GRAPHQL_EXTENSIONS_REGEXP: ()=>GRAPHQL_EXTENSIONS_REGEXP
17
17
  });
18
18
  const JS_AND_TS_EXTENSIONS = [
19
- ".ts",
20
- ".tsx",
21
- ".cts",
22
- ".mts",
23
- ".js",
24
- ".jsx",
25
- ".cjs",
26
- ".mjs",
27
- ".json"
19
+ '.ts',
20
+ '.tsx',
21
+ '.cts',
22
+ '.mts',
23
+ '.js',
24
+ '.jsx',
25
+ '.cjs',
26
+ '.mjs',
27
+ '.json'
28
28
  ];
29
- const JS_EXTENSIONS_GLOB_PART = "{js,jsx,cjs,mjs}";
30
- const TS_EXTENSIONS_GLOB_PART = "{ts,tsx,cts,mts}";
31
- const JS_AND_TS_EXTENSIONS_GLOB_PART = "{js,jsx,cjs,mjs,ts,tsx,cts,mts}";
29
+ const JS_EXTENSIONS_GLOB_PART = '{js,jsx,cjs,mjs}';
30
+ const TS_EXTENSIONS_GLOB_PART = '{ts,tsx,cts,mts}';
31
+ const JS_AND_TS_EXTENSIONS_GLOB_PART = '{js,jsx,cjs,mjs,ts,tsx,cts,mts}';
32
32
  const JS_AND_TS_EXTENSIONS_REGEXP = /\.(js|jsx|cjs|mjs|ts|tsx|cts|mts)$/;
33
33
  const ASSET_EXTENSIONS_REGEXP = /\.(ttf|eot|otf|svg|woff|woff2|mp3|png|jpg|jpeg|gif|ico)$/;
34
34
  const CSS_EXTENSIONS_REGEXP = /\.(css|scss)$/;
package/dist/main.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  let config = {
3
3
  extends: [
4
- require.resolve("./presets/base.js")
4
+ require.resolve('./presets/base.js')
5
5
  ],
6
6
  reportUnusedDisableDirectives: true,
7
7
  // We can't define rules here otherwise they override the ones in the extending configs above. This is bad for actual `overrides`!
@@ -14,20 +14,20 @@ const _typescript = require("../rules/typescript");
14
14
  const _unicorn = require("../rules/unicorn");
15
15
  const config = {
16
16
  parserOptions: {
17
- ecmaVersion: "latest",
18
- sourceType: "module",
17
+ ecmaVersion: 'latest',
18
+ sourceType: 'module',
19
19
  ecmaFeatures: {
20
20
  jsx: true
21
21
  }
22
22
  },
23
23
  plugins: [
24
- "import",
25
- "react",
26
- "react-hooks",
27
- "jsx-a11y",
28
- "eslint-comments",
29
- "promise",
30
- "unicorn"
24
+ 'import',
25
+ 'react',
26
+ 'react-hooks',
27
+ 'jsx-a11y',
28
+ 'eslint-comments',
29
+ 'promise',
30
+ 'unicorn'
31
31
  ],
32
32
  env: {
33
33
  browser: true,
@@ -36,41 +36,41 @@ const config = {
36
36
  serviceworker: true
37
37
  },
38
38
  globals: {
39
- __DEV__: "readonly",
39
+ __DEV__: 'readonly',
40
40
  // metrics and analytics providers
41
- ga: "readonly",
42
- newrelic: "readonly",
41
+ ga: 'readonly',
42
+ newrelic: 'readonly',
43
43
  // mostly for easier compatibility between browsers, workers, etc
44
- global: "readonly",
44
+ global: 'readonly',
45
45
  // mostly references to `process.env.NODE_ENV`
46
- process: "readonly",
46
+ process: 'readonly',
47
47
  // references for globalThis
48
- globalThis: "readonly",
48
+ globalThis: 'readonly',
49
49
  // Webpack variables
50
- __webpack_public_path__: "writeable",
51
- __webpack_require__: "readonly",
52
- __webpack_chunk_load__: "readonly",
53
- __webpack_modules__: "readonly",
54
- __webpack_hash__: "readonly",
55
- __non_webpack_require__: "readonly",
56
- __webpack_exports_info__: "readonly",
57
- DEBUG: "readonly"
50
+ __webpack_public_path__: 'writeable',
51
+ __webpack_require__: 'readonly',
52
+ __webpack_chunk_load__: 'readonly',
53
+ __webpack_modules__: 'readonly',
54
+ __webpack_hash__: 'readonly',
55
+ __non_webpack_require__: 'readonly',
56
+ __webpack_exports_info__: 'readonly',
57
+ DEBUG: 'readonly'
58
58
  },
59
59
  settings: {
60
- "import/ignore": [
61
- "node_modules",
62
- "\\.json$",
60
+ 'import/ignore': [
61
+ 'node_modules',
62
+ '\\.json$',
63
63
  _constants.ASSET_EXTENSIONS_REGEXP.source,
64
64
  _constants.CSS_EXTENSIONS_REGEXP.source,
65
65
  _constants.GRAPHQL_EXTENSIONS_REGEXP.source
66
66
  ],
67
67
  react: {
68
- version: "detect"
68
+ version: 'detect'
69
69
  },
70
70
  propWrapperFunctions: [
71
- "forbidExtraProps",
72
- "exact",
73
- "Object.freeze"
71
+ 'forbidExtraProps',
72
+ 'exact',
73
+ 'Object.freeze'
74
74
  ]
75
75
  },
76
76
  rules: {
@@ -89,17 +89,17 @@ const config = {
89
89
  `*.test.${_constants.JS_AND_TS_EXTENSIONS_GLOB_PART}`
90
90
  ],
91
91
  plugins: [
92
- "jest",
93
- "jest-formatting",
94
- "testing-library"
92
+ 'jest',
93
+ 'jest-formatting',
94
+ 'testing-library'
95
95
  ],
96
96
  settings: {
97
- "testing-library/custom-queries": "off",
98
- "testing-library/custom-renders": "off",
99
- "testing-library/utils-module": "off"
97
+ 'testing-library/custom-queries': 'off',
98
+ 'testing-library/custom-renders': 'off',
99
+ 'testing-library/utils-module': 'off'
100
100
  },
101
101
  globals: {
102
- jsdom: "readonly"
102
+ jsdom: 'readonly'
103
103
  },
104
104
  env: {
105
105
  jest: true,
@@ -110,9 +110,9 @@ const config = {
110
110
  ..._jestFormatting.default,
111
111
  ..._testingLibrary.default,
112
112
  // override ESLint rules
113
- "max-classes-per-file": "off",
113
+ 'max-classes-per-file': 'off',
114
114
  // override eslint-plugin-node rules
115
- "node/no-sync": "off"
115
+ 'node/no-sync': 'off'
116
116
  }
117
117
  },
118
118
  {
@@ -120,11 +120,11 @@ const config = {
120
120
  `*.${_constants.TS_EXTENSIONS_GLOB_PART}`
121
121
  ],
122
122
  plugins: [
123
- "@typescript-eslint"
123
+ '@typescript-eslint'
124
124
  ],
125
- parser: "@typescript-eslint/parser",
125
+ parser: '@typescript-eslint/parser',
126
126
  parserOptions: {
127
- project: "tsconfig.typecheck.json",
127
+ project: 'tsconfig.typecheck.json',
128
128
  // Fixed issue with webstorm
129
129
  tsconfigRootDir: process.cwd()
130
130
  },
@@ -132,23 +132,23 @@ const config = {
132
132
  node: {
133
133
  tryExtensions: _constants.JS_AND_TS_EXTENSIONS
134
134
  },
135
- "import/resolver": {
135
+ 'import/resolver': {
136
136
  typescript: {}
137
137
  },
138
- "import/parsers": {
139
- "@typescript-eslint/parser": [
140
- ".ts",
141
- ".tsx",
142
- ".mts",
143
- ".cts"
138
+ 'import/parsers': {
139
+ '@typescript-eslint/parser': [
140
+ '.ts',
141
+ '.tsx',
142
+ '.mts',
143
+ '.cts'
144
144
  ]
145
145
  }
146
146
  },
147
147
  rules: {
148
148
  ..._typescript.default,
149
149
  // override eslint-plugin-import rules
150
- "import/no-extraneous-dependencies": [
151
- "error",
150
+ 'import/no-extraneous-dependencies': [
151
+ 'error',
152
152
  {
153
153
  devDependencies: [
154
154
  `**/*.test.${_constants.JS_AND_TS_EXTENSIONS_GLOB_PART}`,
@@ -167,8 +167,8 @@ const config = {
167
167
  ],
168
168
  rules: {
169
169
  // override @typescript-eslint/eslint-plugin rules
170
- "@typescript-eslint/ban-ts-comment": "off",
171
- "@typescript-eslint/no-floating-promises": "off"
170
+ '@typescript-eslint/ban-ts-comment': 'off',
171
+ '@typescript-eslint/no-floating-promises': 'off'
172
172
  }
173
173
  }
174
174
  ]
@@ -2,7 +2,7 @@
2
2
  const _nextjs = require("../rules/nextjs");
3
3
  const config = {
4
4
  plugins: [
5
- "@next/next"
5
+ '@next/next'
6
6
  ],
7
7
  rules: {
8
8
  ..._nextjs.default
@@ -2,7 +2,7 @@
2
2
  const _node = require("../rules/node");
3
3
  const config = {
4
4
  plugins: [
5
- "node"
5
+ 'node'
6
6
  ],
7
7
  env: {
8
8
  browser: false,
@@ -10,54 +10,54 @@ const config = {
10
10
  },
11
11
  globals: {
12
12
  // ECMAScript
13
- ArrayBuffer: "readonly",
14
- Atomics: "readonly",
15
- BigInt: "readonly",
16
- BigInt64Array: "readonly",
17
- BigUint64Array: "readonly",
18
- DataView: "readonly",
19
- Float32Array: "readonly",
20
- Float64Array: "readonly",
21
- Int16Array: "readonly",
22
- Int32Array: "readonly",
23
- Int8Array: "readonly",
24
- Map: "readonly",
25
- Promise: "readonly",
26
- Proxy: "readonly",
27
- Reflect: "readonly",
28
- Set: "readonly",
29
- SharedArrayBuffer: "readonly",
30
- Symbol: "readonly",
31
- Uint16Array: "readonly",
32
- Uint32Array: "readonly",
33
- Uint8Array: "readonly",
34
- Uint8ClampedArray: "readonly",
35
- WeakMap: "readonly",
36
- WeakSet: "readonly",
13
+ ArrayBuffer: 'readonly',
14
+ Atomics: 'readonly',
15
+ BigInt: 'readonly',
16
+ BigInt64Array: 'readonly',
17
+ BigUint64Array: 'readonly',
18
+ DataView: 'readonly',
19
+ Float32Array: 'readonly',
20
+ Float64Array: 'readonly',
21
+ Int16Array: 'readonly',
22
+ Int32Array: 'readonly',
23
+ Int8Array: 'readonly',
24
+ Map: 'readonly',
25
+ Promise: 'readonly',
26
+ Proxy: 'readonly',
27
+ Reflect: 'readonly',
28
+ Set: 'readonly',
29
+ SharedArrayBuffer: 'readonly',
30
+ Symbol: 'readonly',
31
+ Uint16Array: 'readonly',
32
+ Uint32Array: 'readonly',
33
+ Uint8Array: 'readonly',
34
+ Uint8ClampedArray: 'readonly',
35
+ WeakMap: 'readonly',
36
+ WeakSet: 'readonly',
37
37
  // ECMAScript (experimental)
38
- globalThis: "readonly",
38
+ globalThis: 'readonly',
39
39
  // ECMA-402
40
- Intl: "readonly",
40
+ Intl: 'readonly',
41
41
  // Web Standard
42
- TextDecoder: "readonly",
43
- TextEncoder: "readonly",
44
- URL: "readonly",
45
- URLSearchParams: "readonly",
46
- WebAssembly: "readonly",
47
- clearInterval: "readonly",
48
- clearTimeout: "readonly",
49
- console: "readonly",
50
- queueMicrotask: "readonly",
51
- setInterval: "readonly",
52
- setTimeout: "readonly",
42
+ TextDecoder: 'readonly',
43
+ TextEncoder: 'readonly',
44
+ URL: 'readonly',
45
+ URLSearchParams: 'readonly',
46
+ WebAssembly: 'readonly',
47
+ clearInterval: 'readonly',
48
+ clearTimeout: 'readonly',
49
+ console: 'readonly',
50
+ queueMicrotask: 'readonly',
51
+ setInterval: 'readonly',
52
+ setTimeout: 'readonly',
53
53
  // Node.js
54
- Buffer: "readonly",
55
- GLOBAL: "readonly",
56
- clearImmediate: "readonly",
57
- global: "readonly",
58
- process: "readonly",
59
- root: "readonly",
60
- setImmediate: "readonly",
54
+ Buffer: 'readonly',
55
+ GLOBAL: 'readonly',
56
+ clearImmediate: 'readonly',
57
+ global: 'readonly',
58
+ process: 'readonly',
59
+ root: 'readonly',
60
+ setImmediate: 'readonly',
61
61
  // Other
62
62
  __dirname: false,
63
63
  __filename: false,
@@ -68,29 +68,29 @@ const config = {
68
68
  settings: {
69
69
  node: {
70
70
  tryExtensions: [
71
- ".js",
72
- ".jsx",
73
- ".json",
74
- ".mjs",
75
- ".cjs"
71
+ '.js',
72
+ '.jsx',
73
+ '.json',
74
+ '.mjs',
75
+ '.cjs'
76
76
  ]
77
77
  },
78
78
  convertPath: {
79
- "src/**/*.ts": [
80
- "^src/(.+?)\\.ts$",
81
- "lib/$1.js"
79
+ 'src/**/*.ts': [
80
+ '^src/(.+?)\\.ts$',
81
+ 'lib/$1.js'
82
82
  ],
83
- "src/**/*.tsx": [
84
- "^src/(.+?)\\.tsx$",
85
- "lib/$1.js"
83
+ 'src/**/*.tsx': [
84
+ '^src/(.+?)\\.tsx$',
85
+ 'lib/$1.js'
86
86
  ],
87
- "src/**/*.mts": [
88
- "^src/(.+?)\\.ts$",
89
- "esm/$1.js"
87
+ 'src/**/*.mts': [
88
+ '^src/(.+?)\\.ts$',
89
+ 'esm/$1.js'
90
90
  ],
91
- "src/**/*.cts": [
92
- "^src/(.+?)\\.tsx$",
93
- "lib/$1.js"
91
+ 'src/**/*.cts': [
92
+ '^src/(.+?)\\.tsx$',
93
+ 'lib/$1.js'
94
94
  ]
95
95
  }
96
96
  },
@@ -2,10 +2,10 @@
2
2
  const _prettier = require("../rules/prettier");
3
3
  const config = {
4
4
  extends: [
5
- "eslint-config-prettier"
5
+ 'eslint-config-prettier'
6
6
  ],
7
7
  plugins: [
8
- "eslint-plugin-prettier"
8
+ 'eslint-plugin-prettier'
9
9
  ],
10
10
  rules: {
11
11
  ..._prettier.default
@@ -5,70 +5,70 @@ Object.defineProperty(exports, "default", {
5
5
  });
6
6
  const config = {
7
7
  // eslint-plugin-jsx-a11y rules
8
- "jsx-a11y/alt-text": "warn",
9
- "jsx-a11y/anchor-has-content": [
10
- "warn",
8
+ 'jsx-a11y/alt-text': 'warn',
9
+ 'jsx-a11y/anchor-has-content': [
10
+ 'warn',
11
11
  {
12
12
  components: [
13
- "Link"
13
+ 'Link'
14
14
  ]
15
15
  }
16
16
  ],
17
- "jsx-a11y/anchor-is-valid": [
18
- "error",
17
+ 'jsx-a11y/anchor-is-valid': [
18
+ 'error',
19
19
  {
20
20
  components: [
21
- "Link"
21
+ 'Link'
22
22
  ],
23
23
  specialLink: [
24
- "hrefLeft",
25
- "hrefRight",
26
- "to"
24
+ 'hrefLeft',
25
+ 'hrefRight',
26
+ 'to'
27
27
  ]
28
28
  }
29
29
  ],
30
- "jsx-a11y/aria-activedescendant-has-tabindex": "warn",
31
- "jsx-a11y/aria-props": "error",
32
- "jsx-a11y/aria-proptypes": "error",
33
- "jsx-a11y/aria-role": [
34
- "error",
30
+ 'jsx-a11y/aria-activedescendant-has-tabindex': 'warn',
31
+ 'jsx-a11y/aria-props': 'error',
32
+ 'jsx-a11y/aria-proptypes': 'error',
33
+ 'jsx-a11y/aria-role': [
34
+ 'error',
35
35
  {
36
36
  ignoreNonDOM: false
37
37
  }
38
38
  ],
39
- "jsx-a11y/aria-unsupported-elements": "error",
40
- "jsx-a11y/autocomplete-valid": "warn",
41
- "jsx-a11y/click-events-have-key-events": "warn",
42
- "jsx-a11y/control-has-associated-label": "warn",
43
- "jsx-a11y/heading-has-content": [
44
- "warn",
39
+ 'jsx-a11y/aria-unsupported-elements': 'error',
40
+ 'jsx-a11y/autocomplete-valid': 'warn',
41
+ 'jsx-a11y/click-events-have-key-events': 'warn',
42
+ 'jsx-a11y/control-has-associated-label': 'warn',
43
+ 'jsx-a11y/heading-has-content': [
44
+ 'warn',
45
45
  {
46
46
  components: [
47
- "Typography"
47
+ 'Typography'
48
48
  ]
49
49
  }
50
50
  ],
51
- "jsx-a11y/html-has-lang": "warn",
52
- "jsx-a11y/iframe-has-title": "warn",
53
- "jsx-a11y/img-redundant-alt": "warn",
54
- "jsx-a11y/interactive-supports-focus": "warn",
55
- "jsx-a11y/label-has-associated-control": "warn",
56
- "jsx-a11y/lang": "error",
57
- "jsx-a11y/media-has-caption": "warn",
58
- "jsx-a11y/mouse-events-have-key-events": "warn",
59
- "jsx-a11y/no-access-key": "warn",
60
- "jsx-a11y/no-autofocus": "off",
61
- "jsx-a11y/no-distracting-elements": "error",
62
- "jsx-a11y/no-interactive-element-to-noninteractive-role": "warn",
63
- "jsx-a11y/no-noninteractive-element-interactions": "warn",
64
- "jsx-a11y/no-noninteractive-element-to-interactive-role": "warn",
65
- "jsx-a11y/no-noninteractive-tabindex": "error",
66
- "jsx-a11y/no-redundant-roles": "error",
67
- "jsx-a11y/no-static-element-interactions": "warn",
68
- "jsx-a11y/role-has-required-aria-props": "error",
69
- "jsx-a11y/role-supports-aria-props": "error",
70
- "jsx-a11y/scope": "error",
71
- "jsx-a11y/tabindex-no-positive": "error"
51
+ 'jsx-a11y/html-has-lang': 'warn',
52
+ 'jsx-a11y/iframe-has-title': 'warn',
53
+ 'jsx-a11y/img-redundant-alt': 'warn',
54
+ 'jsx-a11y/interactive-supports-focus': 'warn',
55
+ 'jsx-a11y/label-has-associated-control': 'warn',
56
+ 'jsx-a11y/lang': 'error',
57
+ 'jsx-a11y/media-has-caption': 'warn',
58
+ 'jsx-a11y/mouse-events-have-key-events': 'warn',
59
+ 'jsx-a11y/no-access-key': 'warn',
60
+ 'jsx-a11y/no-autofocus': 'off',
61
+ 'jsx-a11y/no-distracting-elements': 'error',
62
+ 'jsx-a11y/no-interactive-element-to-noninteractive-role': 'warn',
63
+ 'jsx-a11y/no-noninteractive-element-interactions': 'warn',
64
+ 'jsx-a11y/no-noninteractive-element-to-interactive-role': 'warn',
65
+ 'jsx-a11y/no-noninteractive-tabindex': 'error',
66
+ 'jsx-a11y/no-redundant-roles': 'error',
67
+ 'jsx-a11y/no-static-element-interactions': 'warn',
68
+ 'jsx-a11y/role-has-required-aria-props': 'error',
69
+ 'jsx-a11y/role-supports-aria-props': 'error',
70
+ 'jsx-a11y/scope': 'error',
71
+ 'jsx-a11y/tabindex-no-positive': 'error'
72
72
  };
73
73
  const _default = config;
74
74
 
@@ -5,24 +5,24 @@ Object.defineProperty(exports, "default", {
5
5
  });
6
6
  const config = {
7
7
  // eslint-plugin-eslint-comments rules
8
- "eslint-comments/disable-enable-pair": [
9
- "error",
8
+ 'eslint-comments/disable-enable-pair': [
9
+ 'error',
10
10
  {
11
11
  allowWholeFile: true
12
12
  }
13
13
  ],
14
- "eslint-comments/no-aggregating-enable": "error",
15
- "eslint-comments/no-duplicate-disable": "error",
16
- "eslint-comments/no-restricted-disable": "off",
17
- "eslint-comments/no-unlimited-disable": "error",
18
- "eslint-comments/no-unused-disable": "off",
19
- "eslint-comments/no-unused-enable": "error",
20
- "eslint-comments/no-use": "off",
21
- "eslint-comments/require-description": [
22
- "error",
14
+ 'eslint-comments/no-aggregating-enable': 'error',
15
+ 'eslint-comments/no-duplicate-disable': 'error',
16
+ 'eslint-comments/no-restricted-disable': 'off',
17
+ 'eslint-comments/no-unlimited-disable': 'error',
18
+ 'eslint-comments/no-unused-disable': 'off',
19
+ 'eslint-comments/no-unused-enable': 'error',
20
+ 'eslint-comments/no-use': 'off',
21
+ 'eslint-comments/require-description': [
22
+ 'error',
23
23
  {
24
24
  ignore: [
25
- "eslint-enable"
25
+ 'eslint-enable'
26
26
  ]
27
27
  }
28
28
  ]