@scayle/eslint-config-storefront 3.2.5

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/CHANGELOG.md ADDED
@@ -0,0 +1,106 @@
1
+ # @aboutyou/eslint-config-sfc
2
+
3
+ ## 3.2.5
4
+
5
+ ### Patch Changes
6
+
7
+ - Add license file
8
+
9
+ ## 3.2.4
10
+
11
+ ### Patch Changes
12
+
13
+ - raise required eslint peerDependency version to v8.49.0 and use only fixed dependency versions
14
+
15
+ ## 3.2.3
16
+
17
+ ### Patch Changes
18
+
19
+ - disable custom config for eslint-plugin-n and rely on js-standard config
20
+
21
+ ## 3.2.2
22
+
23
+ ### Patch Changes
24
+
25
+ - update dependencies to latest
26
+ - export json and vue-base eslint configs
27
+
28
+ ## 3.2.1
29
+
30
+ ### Patch Changes
31
+
32
+ - remove deprecated package exports
33
+
34
+ ## 3.2.0
35
+
36
+ ### Minor Changes
37
+
38
+ - Remove markdown codeblock linting
39
+
40
+ ### Patch Changes
41
+
42
+ - add shared config for Nuxt2/Vue2
43
+
44
+ ## 3.1.0
45
+
46
+ ### Minor Changes
47
+
48
+ - - Replaced `enums` with the companion object pattern approach.
49
+
50
+ ## 3.0.0
51
+
52
+ ### Major Changes
53
+
54
+ - **Changed NPM package names**
55
+
56
+ - **Breaking**: Change package scope and name of `@aboutyou/scayle-sfc-nuxt` to `@scayle/storefront-nuxt2`
57
+ - **Breaking**: Change package scope and name of `@aboutyou/sfc-nuxt3` to `@scayle/storefront-nuxt`
58
+ - **Breaking**: Change package scope and name of `@aboutyou/scayle-sfc-lib` to `@scayle/storefront-core`
59
+ - **Breaking**: Change package scope and name of `@aboutyou/eslint-config-sfc` to `@scayle/eslint-config-storefront`
60
+ - **Breaking**: Change package scope and name of `@aboutyou/prettier-config-sfc` to `@scayle/prettier-config-storefront`
61
+
62
+ _NOTE: Due to the changes of the NPM package scope from `@aboutyou` to `@scayle`,
63
+ it is required to change the consuming projects local `.npmrc` file as follows:_
64
+
65
+ - Before:
66
+
67
+ ```
68
+ @aboutyou:registry=https://gitlab.com/api/v4/packages/npm/
69
+ ```
70
+
71
+ - After:
72
+
73
+ ```
74
+ @aboutyou:registry=https://gitlab.com/api/v4/projects/29746107/packages/npm/
75
+ @scayle:registry=https://gitlab.com/api/v4/projects/29746107/packages/npm/
76
+ ```
77
+
78
+ - **Breaking**: Minimum `node` version raised to `18.15.0`
79
+
80
+ ## 3.0.0-alpha.0
81
+
82
+ ### Major Changes
83
+
84
+ - **Changed NPM package names**
85
+
86
+ - **Breaking**: Change package scope and name of `@aboutyou/scayle-sfc-nuxt` to `@scayle/storefront-nuxt2`
87
+ - **Breaking**: Change package scope and name of `@aboutyou/sfc-nuxt3` to `@scayle/storefront-nuxt`
88
+ - **Breaking**: Change package scope and name of `@aboutyou/scayle-sfc-lib` to `@scayle/storefront-core``
89
+ - **Breaking**: Change package scope and name of `@aboutyou/eslint-config-sfc` to `@scayle/eslint-config-storefront`
90
+ - **Breaking**: Change package scope and name of `@aboutyou/prettier-config-sfc` to `@scayle/prettier-config-storefront`
91
+
92
+ Due to the changes of the NPM package scope from `@aboutyou` to `@scayle`,
93
+ it is required to change the consuming projects local `.npmrc` file as follows:
94
+
95
+ - Before: `@aboutyou:registry=https://gitlab.com/api/v4/packages/npm/`
96
+ - After: `@scayle:registry=https://gitlab.com/api/v4/packages/npm/`
97
+
98
+ - Minimum node version is 18.15.0
99
+
100
+ ## 2.0.0
101
+
102
+ ### Major Changes
103
+
104
+ - chore: refine eslint configs for vue, yml, json and md
105
+ - Breaking: renamed vue config to nuxt config
106
+ - chore: export dedicated eslint configs for yml, json and md
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 SCAYLE GmbH
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 ADDED
@@ -0,0 +1,233 @@
1
+ # eslint-config-storefront
2
+
3
+ A [shared `eslint` config](https://eslint.org/docs/latest/extend/shareable-configs#creating-a-shareable-config) for SCAYLE Storefront Core v2 and SCAYLE frontend projects.
4
+
5
+ ---
6
+
7
+ ## ESLint
8
+
9
+ > ESLint statically analyzes your code to quickly find problems. It is built into most text editors and you can run ESLint as part of your continuous integration pipeline.
10
+
11
+ - [Official ESLint Documentation](https://eslint.org/docs/latest/)
12
+
13
+ ### Provides shared configurations
14
+
15
+ #### Default config / `@scayle/eslint-config-storefront`
16
+
17
+ Provides Scayle-specific `eslint` configuration for Frontend and Node.js projects using TypeScript.
18
+
19
+ #### Nuxt 2 config / `@scayle/eslint-config-storefront/nuxt/nuxt2`
20
+
21
+ Provides a Vue2- and Nuxt2-specific partial configuration for `eslint`.
22
+ Based on `plugin:vue/recommended` and should be used with [`@scayle/eslint-config-storefront`](#default-config)
23
+
24
+ #### Nuxt 3 config / `@scayle/eslint-config-storefront/nuxt/nuxt`
25
+
26
+ Provides a Vue3- and Nuxt2-specific partial configuration for `eslint`.
27
+ Based on `plugin:vue/vue-3recommended` and should be used with [`@scayle/eslint-config-storefront`](#default-config)
28
+
29
+ ### Used plugins and configurations
30
+
31
+ #### `@rushstack/eslint-patch`
32
+
33
+ > A patch that improves how ESLint loads plugins when working in a monorepo with a reusable toolchain
34
+
35
+ **Why?**
36
+ This patch allows a shared config to include its own `eslint` plugins instead of having them required as peer dependencies for every package that uses this config, which by itself is not yet supported by `eslint`.
37
+
38
+ - License: [**MIT**](https://github.com/microsoft/rushstack/blob/main/eslint/eslint-patch/LICENSE)
39
+ - [README](https://github.com/microsoft/rushstack/blob/main/eslint/eslint-patch/README.md)
40
+ - [Repository](https://github.com/microsoft/rushstack/tree/main/eslint/eslint-patch)
41
+
42
+ #### `@typescript-eslint/eslint-plugin` & `@typescript-eslint/parser`
43
+
44
+ > The tooling that enables ESLint and Prettier to support TypeScript.
45
+
46
+ **Why?**
47
+ Enables support for parsing and linting TypeScript files.
48
+
49
+ - License: [**Use and redistribution without modification**](https://github.com/typescript-eslint/typescript-eslint/blob/main/LICENSE)
50
+ - [Documentation](https://typescript-eslint.io/)
51
+ - [Repository](https://github.com/typescript-eslint/typescript-eslint)
52
+
53
+ #### `eslint-config-prettier`
54
+
55
+ > Turns off all rules that are unnecessary or might conflict with Prettier.
56
+
57
+ **Why?**
58
+ Disables all relevant `eslint` rules that are covered by `prettier`, thus avoiding conflicts between tools.
59
+
60
+ - [**MIT**](https://github.com/prettier/eslint-config-prettier/blob/main/LICENSE)
61
+ - [Readme](https://github.com/prettier/eslint-config-prettier/blob/main/README.md)
62
+ - [Repository](https://github.com/prettier/eslint-config-prettier)
63
+
64
+ #### `eslint-config-standard`
65
+
66
+ > An ESLint Shareable Config for JavaScript Standard Style
67
+
68
+ **Why?**
69
+ Provides JavaScript Standard code style compliant ruleset.
70
+
71
+ - License: [**MIT**](https://github.com/standard/eslint-config-standard/blob/master/LICENSE)
72
+ - [JavaScript Standard Style Documentation](https://standardjs.com/)
73
+ - [Repository](https://github.com/standard/eslint-config-standard)
74
+
75
+ #### `eslint-plugin-eslint-comments`
76
+
77
+ > Additional ESLint rules for ESLint directive comments (e.g.`//eslint-disable-line`).
78
+
79
+ **Why?**
80
+ Provides linting rule targeted at disabling `eslint` code comments, thus allowing fain-grained control what is allowed to be disabled and what needs to be addressed instead.
81
+
82
+ - License: [**MIT**](https://github.com/mysticatea/eslint-plugin-eslint-comments/blob/master/LICENSE)
83
+ - [Documentation](https://mysticatea.github.io/eslint-plugin-eslint-comments/)
84
+ - [Repository](https://github.com/mysticatea/eslint-plugin-eslint-comments)
85
+
86
+ #### `eslint-plugin-html`
87
+
88
+ > A ESLint plugin to lint and fix inline scripts contained in HTML files.
89
+
90
+ **Why?**
91
+ Allows to lint code within `<script>` tags in HTML markup.
92
+
93
+ - License: [**Use and redistribution without modification**](https://github.com/BenoitZugmeyer/eslint-plugin-html/blob/main/LICENSE)
94
+ - [README](https://github.com/BenoitZugmeyer/eslint-plugin-html/blob/main/README.md)
95
+ - [Repository](https://github.com/BenoitZugmeyer/eslint-plugin-html)
96
+
97
+ #### `eslint-plugin-import`
98
+
99
+ > This plugin intends to support linting of ES2015+ (ES6+) import/export syntax, and prevent issues with misspelling of file paths and import names.
100
+
101
+ **Why?**
102
+ Extends the linting ruleset to support ES6+ import/export syntax, thus reducing amount of false-positives in default `eslint` setup.
103
+
104
+ - License: [**MIT**](https://github.com/import-js/eslint-plugin-import/blob/main/LICENSE)
105
+ - [README](https://github.com/import-js/eslint-plugin-import/blob/main/README.md)
106
+ - [Repository](https://github.com/import-js/eslint-plugin-import)
107
+
108
+ #### `eslint-plugin-jsonc` & `jsonc-eslint-parser`
109
+
110
+ > This ESLint plugin provides linting rules relate to better ways to help you avoid problems when using JSON, JSONC and JSON5.
111
+
112
+ **Why?**
113
+ Enables support for parsing and extends linting of JSON-based files.
114
+
115
+ - License: [**MIT**](https://github.com/ota-meshi/eslint-plugin-jsonc/blob/master/LICENSE)
116
+ - [eslint-plugin-jsonc Documentation](https://ota-meshi.github.io/eslint-plugin-jsonc/)
117
+ - [eslint-plugin-jsonc Repository](https://github.com/ota-meshi/eslint-plugin-jsonc)
118
+ - [jsonc-eslint-parser Repository](https://github.com/ota-meshi/jsonc-eslint-parser)
119
+
120
+ #### `eslint-plugin-markdown`
121
+
122
+ > Lint JS, JSX, TypeScript, and more inside Markdown.
123
+
124
+ **Why?**
125
+ Allows to lint code blocks within Markdown files.
126
+
127
+ - License: [**MIT**](https://github.com/eslint/eslint-plugin-markdown/blob/main/LICENSE)
128
+ - [README](https://github.com/eslint/eslint-plugin-markdown/blob/main/README.md)
129
+ - [Repository](https://github.com/eslint/eslint-plugin-markdown)
130
+
131
+ #### `eslint-plugin-n`
132
+
133
+ > Additional ESLint's rules for Node.js
134
+
135
+ **Why?**
136
+ Provides support for Node.js specifics code and compatibility checks.
137
+
138
+ - License: [**MIT**](https://github.com/eslint-community/eslint-plugin-n/blob/master/LICENSE)
139
+ - [README](https://github.com/eslint-community/eslint-plugin-n/blob/master/README.md)
140
+ - [Repository](https://github.com/eslint-community/eslint-plugin-n)
141
+
142
+ #### `eslint-plugin-no-unsanitized`
143
+
144
+ > These rules disallow unsafe coding practices that may result into security vulnerabilities.
145
+
146
+ **Why?**
147
+ Will disallow assignments (e.g., to `innerHTML`) as well as calls (e.g., to `insertAdjacentHTML`) without the use of a pre-defined escaping function.
148
+
149
+ - License: [**Mozilla Public License 2.0**](https://github.com/mozilla/eslint-plugin-no-unsanitized/blob/main/LICENSE)
150
+ - [README](https://github.com/mozilla/eslint-plugin-no-unsanitized/blob/main/README.md)
151
+ - [Repository](https://github.com/mozilla/eslint-plugin-no-unsanitized)
152
+
153
+ #### `eslint-plugin-nuxt`
154
+
155
+ > ESLint plugin for Nuxt.js
156
+
157
+ **Why?**
158
+ Provides Nuxt.js-specific linting ruleset and configuration.
159
+
160
+ - License: [**MIT**](https://github.com/nuxt/eslint-plugin-nuxt/blob/master/LICENSE)
161
+ - [README](https://github.com/nuxt/eslint-plugin-nuxt/blob/master/README.md)
162
+ - [Repository](https://github.com/nuxt/eslint-plugin-nuxt)
163
+
164
+ #### `eslint-plugin-promise`
165
+
166
+ > Enforce best practices for JavaScript promises.
167
+
168
+ **Why?**
169
+ Provides ruleset to enforce best practices for JavaScript promises.
170
+
171
+ - License: [**ISC**](https://github.com/eslint-community/eslint-plugin-promise/blob/main/LICENSE.md)
172
+ - [README](https://github.com/eslint-community/eslint-plugin-promise/blob/main/README.md)
173
+ - [Repository](https://github.com/eslint-community/eslint-plugin-promise)
174
+
175
+ #### `eslint-plugin-sonarjs`
176
+
177
+ **NOTE: Currently not enabled!**
178
+
179
+ > SonarJS rules for ESLint to detect bugs and suspicious patterns in your code.
180
+
181
+ **Why**
182
+ Provides ruleset to detect possibler code smells and common sources for bugs.
183
+
184
+ - License: [**LGPL-3.0**](https://github.com/SonarSource/eslint-plugin-sonarjs/blob/master/LICENSE)
185
+ - [README](https://github.com/SonarSource/eslint-plugin-sonarjs/blob/master/README.md)
186
+ - [Repository](https://github.com/SonarSource/eslint-plugin-sonarjs)
187
+
188
+ #### `eslint-plugin-unicorn`
189
+
190
+ **NOTE: Currently not enabled!**
191
+
192
+ > More than 100 powerful ESLint rules for best practice and security purposes
193
+
194
+ **Why**
195
+ ...
196
+
197
+ - License: [**MIT**](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/license)
198
+ - [README](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/readme.md)
199
+ - [Repository](https://github.com/sindresorhus/eslint-plugin-unicorn)
200
+
201
+ #### `eslint-plugin-unused-imports`
202
+
203
+ > Find and remove unused es6 module imports
204
+
205
+ **Why?**
206
+ Extends analysis of ES6+ module imports by hooking into `no-unused-vars` for JavaScript and TypeScript files.
207
+
208
+ - License: [**MIT**](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/license)
209
+ - [README](https://github.com/sweepline/eslint-plugin-unused-imports/blob/master/README.md)
210
+ - [Repository](https://github.com/sweepline/eslint-plugin-unused-imports)
211
+
212
+ #### `eslint-plugin-vue`
213
+
214
+ > Official ESLint plugin for Vue.js.
215
+
216
+ **Why?**
217
+ Provides Vue-specific linting ruleset and configuration. Supports both Vue2 and Vue3.
218
+
219
+ - License: [**MIT**](https://github.com/vuejs/eslint-plugin-vue/blob/master/LICENSE)
220
+ - [Documentation](https://eslint.vuejs.org/)
221
+ - [Repository](https://github.com/vuejs/eslint-plugin-vue)
222
+
223
+ #### `eslint-plugin-yml` & `yaml-eslint-parser`
224
+
225
+ > eslint-plugin-yml is ESLint plugin provides linting rules for YAML.
226
+
227
+ **Why?**
228
+ Enables support for parsing and extends linting of YAML-based files.
229
+
230
+ - License: [**MIT**](https://github.com/ota-meshi/eslint-plugin-yml/blob/master/LICENSE)
231
+ - [eslint-plugin-yml Documentation](https://ota-meshi.github.io/eslint-plugin-yml/)
232
+ - [eslint-plugin-yml Repository](https://github.com/ota-meshi/eslint-plugin-yml)
233
+ - [yaml-eslint-parser Repository](https://github.com/ota-meshi/yaml-eslint-parser)
@@ -0,0 +1,112 @@
1
+ /**
2
+ * Shared eslint config for codeblocks within MD / Markdown
3
+ * https://eslint.org/docs/latest/
4
+ *
5
+ * Partially based on
6
+ * - https://github.com/antfu/eslint-config/blob/main/packages/eslint-config-basic
7
+ */
8
+
9
+ // A patch that improves how ESLint loads plugins when
10
+ // working in a monorepo with a reusable toolchain.
11
+ // https://github.com/microsoft/rushstack/tree/main/eslint/eslint-patch
12
+ require('@rushstack/eslint-patch/modern-module-resolution')
13
+
14
+ /** @type {import('eslint').ESLint.ConfigData} */
15
+ module.exports = {
16
+ extends: ['plugin:jsonc/recommended-with-jsonc'],
17
+ overrides: [
18
+ {
19
+ // JSON(C) specific rule overrides
20
+ // https://ota-meshi.github.io/eslint-plugin-jsonc/
21
+ // https://github.com/ota-meshi/jsonc-eslint-parser
22
+ files: ['*.json', '*.json5'],
23
+ parser: 'jsonc-eslint-parser',
24
+ rules: {
25
+ 'jsonc/array-bracket-spacing': ['error', 'never'],
26
+ 'jsonc/comma-dangle': ['error', 'never'],
27
+ 'jsonc/comma-style': ['error', 'last'],
28
+ 'jsonc/indent': ['error', 2],
29
+ 'jsonc/key-spacing': [
30
+ 'error',
31
+ { beforeColon: false, afterColon: true },
32
+ ],
33
+ 'jsonc/no-octal-escape': 'error',
34
+ 'jsonc/object-curly-newline': [
35
+ 'error',
36
+ { multiline: true, consistent: true },
37
+ ],
38
+ 'jsonc/object-curly-spacing': ['error', 'always'],
39
+ 'jsonc/object-property-newline': [
40
+ 'error',
41
+ { allowMultiplePropertiesPerLine: true },
42
+ ],
43
+ },
44
+ },
45
+ {
46
+ // package.json specific rule overrides
47
+ // https://ota-meshi.github.io/eslint-plugin-jsonc/rules/sort-keys.html
48
+ files: ['package.json'],
49
+ parser: 'jsonc-eslint-parser',
50
+ rules: {
51
+ 'jsonc/sort-keys': [
52
+ 'error',
53
+ {
54
+ pathPattern: '^$',
55
+ order: [
56
+ 'publisher',
57
+ 'name',
58
+ 'displayName',
59
+ 'type',
60
+ 'version',
61
+ 'private',
62
+ 'packageManager',
63
+ 'description',
64
+ 'author',
65
+ 'license',
66
+ 'funding',
67
+ 'homepage',
68
+ 'repository',
69
+ 'bugs',
70
+ 'keywords',
71
+ 'categories',
72
+ 'sideEffects',
73
+ 'exports',
74
+ 'main',
75
+ 'module',
76
+ 'unpkg',
77
+ 'types',
78
+ 'typesVersions',
79
+ 'bin',
80
+ 'icon',
81
+ 'files',
82
+ 'engines',
83
+ 'activationEvents',
84
+ 'contributes',
85
+ 'scripts',
86
+ 'peerDependencies',
87
+ 'peerDependenciesMeta',
88
+ 'dependencies',
89
+ 'optionalDependencies',
90
+ 'devDependencies',
91
+ 'pnpm',
92
+ 'overrides',
93
+ 'resolutions',
94
+ 'husky',
95
+ 'simple-git-hooks',
96
+ 'lint-staged',
97
+ 'eslintConfig',
98
+ ],
99
+ },
100
+ {
101
+ pathPattern: '^(?:dev|peer|optional|bundled)?[Dd]ependencies$',
102
+ order: { type: 'asc' },
103
+ },
104
+ {
105
+ pathPattern: '^exports.*$',
106
+ order: ['types', 'require', 'import'],
107
+ },
108
+ ],
109
+ },
110
+ },
111
+ ],
112
+ }
@@ -0,0 +1,57 @@
1
+ /**
2
+ * Shared eslint config for Vue
3
+ * https://eslint.org/docs/latest/
4
+ *
5
+ */
6
+
7
+ /** @type {import('eslint').ESLint.ConfigData} */
8
+ module.exports = {
9
+ overrides: [
10
+ {
11
+ files: ['*.vue'],
12
+ parser: 'vue-eslint-parser',
13
+ parserOptions: {
14
+ parser: '@typescript-eslint/parser',
15
+ },
16
+ // https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/eslint-recommended.ts
17
+ rules: {
18
+ 'no-unused-vars': 'off',
19
+ 'constructor-super': 'off', // ts(2335) & ts(2377)
20
+ 'getter-return': 'off', // ts(2378)
21
+ 'no-const-assign': 'off', // ts(2588)
22
+ 'no-dupe-args': 'off', // ts(2300)
23
+ 'no-dupe-class-members': 'off', // ts(2393) & ts(2300)
24
+ 'no-dupe-keys': 'off', // ts(1117)
25
+ 'no-func-assign': 'off', // ts(2539)
26
+ 'no-import-assign': 'off', // ts(2539) & ts(2540)
27
+ 'no-new-symbol': 'off', // ts(7009)
28
+ 'no-obj-calls': 'off', // ts(2349)
29
+ 'no-redeclare': 'off', // ts(2451)
30
+ 'no-setter-return': 'off', // ts(2408)
31
+ 'no-this-before-super': 'off', // ts(2376)
32
+ 'no-undef': 'off', // ts(2304)
33
+ 'no-unreachable': 'off', // ts(7027)
34
+ 'no-unsafe-negation': 'off', // ts(2365) & ts(2360) & ts(2358)
35
+ 'no-var': 'error', // ts transpiles let/const to var, so no need for vars any more
36
+ 'prefer-const': 'error', // ts provides better types with const
37
+ 'prefer-rest-params': 'error', // ts provides better types with rest args over arguments
38
+ 'prefer-spread': 'error', // ts transpiles spread to apply, so no need for manual apply
39
+ 'valid-typeof': 'off', // ts(2367)
40
+ },
41
+ },
42
+
43
+ {
44
+ files: [
45
+ // These pages are not used directly by users so they can have one-word names.
46
+ // https://github.com/nuxt/eslint-config/blob/main/packages/eslint-config/index.js#L66
47
+ '**/pages/**/*.{js,ts,jsx,tsx,vue}',
48
+ '**/layouts/**/*.{js,ts,jsx,tsx,vue}',
49
+ '**/app.{js,ts,jsx,tsx,vue}',
50
+ '**/error.{js,ts,jsx,tsx,vue}',
51
+ // These files should have multiple words in their names as they are within subdirectories.
52
+ '**/components/*/**/*.{js,ts,jsx,tsx,vue}',
53
+ ],
54
+ rules: { 'vue/multi-word-component-names': 'off' },
55
+ },
56
+ ],
57
+ }
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Shared eslint config for codeblocks within MD / Markdown
3
+ * https://eslint.org/docs/latest/
4
+ *
5
+ * Partially based on
6
+ * - https://github.com/antfu/eslint-config/blob/main/packages/eslint-config-basic
7
+ */
8
+
9
+ // A patch that improves how ESLint loads plugins when
10
+ // working in a monorepo with a reusable toolchain.
11
+ // https://github.com/microsoft/rushstack/tree/main/eslint/eslint-patch
12
+ require('@rushstack/eslint-patch/modern-module-resolution')
13
+
14
+ /** @type {import('eslint').ESLint.ConfigData} */
15
+ module.exports = {
16
+ extends: ['plugin:yml/standard', 'plugin:yml/prettier'],
17
+ overrides: [
18
+ {
19
+ // YAML specific rule overrides
20
+ // https://ota-meshi.github.io/eslint-plugin-yml/
21
+ // https://github.com/ota-meshi/yaml-eslint-parser
22
+ files: ['*.yaml', '*.yml'],
23
+ parser: 'yaml-eslint-parser',
24
+ rules: {
25
+ 'spaced-comment': 'off',
26
+ },
27
+ },
28
+ ],
29
+ }
package/index.js ADDED
@@ -0,0 +1,240 @@
1
+ /**
2
+ * Shared eslint config
3
+ * https://eslint.org/docs/latest/
4
+ *
5
+ * Partially based on
6
+ * - https://github.com/antfu/eslint-config/blob/main/packages/eslint-config-basic
7
+ */
8
+
9
+ // A patch that improves how ESLint loads plugins when
10
+ // working in a monorepo with a reusable toolchain.
11
+ // https://github.com/microsoft/rushstack/tree/main/eslint/eslint-patch
12
+ require('@rushstack/eslint-patch/modern-module-resolution')
13
+
14
+ /** @type {import('eslint').ESLint.ConfigData} */
15
+ module.exports = {
16
+ parserOptions: {
17
+ ecmaVersion: '2018',
18
+ parser: {
19
+ js: 'espree',
20
+ jsx: 'espree',
21
+ // eslint-disable-next-line sonarjs/no-duplicate-string
22
+ ts: '@typescript-eslint/parser',
23
+ tsx: '@typescript-eslint/parser',
24
+ },
25
+ extraFileExtensions: ['.vue'],
26
+ ecmaFeatures: {
27
+ jsx: true,
28
+ },
29
+ },
30
+ env: {
31
+ es6: true,
32
+ browser: true,
33
+ node: true,
34
+ },
35
+ // Reports errors for unused `eslint-disable directives`
36
+ // when no problems would be reported in the disabled area
37
+ // https://eslint.org/docs/latest/integrate/nodejs-api#linterverify
38
+ reportUnusedDisableDirectives: true,
39
+ ignorePatterns: [
40
+ '__snapshots__',
41
+ '.nuxt',
42
+ '.output',
43
+ '*.d.ts',
44
+ '*.min.*',
45
+ 'build',
46
+ 'CHANGELOG.md',
47
+ 'coverage',
48
+ 'dist',
49
+ 'LICENSE*',
50
+ 'node_modules',
51
+ 'out',
52
+ 'output',
53
+ 'package-lock.json',
54
+ 'pnpm-lock.yaml',
55
+ 'public',
56
+ 'temp',
57
+ 'yarn.lock',
58
+ // ignore for in lint-staged
59
+ '*.css',
60
+ '*.png',
61
+ '*.ico',
62
+ '*.toml',
63
+ '*.patch',
64
+ '*.txt',
65
+ '*.crt',
66
+ '*.csr',
67
+ '*.key',
68
+ 'Dockerfile',
69
+ '!.vscode',
70
+ ],
71
+ extends: [
72
+ 'plugin:@typescript-eslint/eslint-recommended',
73
+ 'standard',
74
+ // 'plugin:n/recommended', // Disabled to to config collision with 'standard'
75
+ 'plugin:import/recommended',
76
+ 'plugin:import/typescript',
77
+ 'plugin:eslint-comments/recommended',
78
+ 'plugin:sonarjs/recommended',
79
+ 'plugin:no-unsanitized/DOM',
80
+ // 'plugin:unicorn/recommended',
81
+ './config/eslint-config-yml.cjs',
82
+ 'prettier',
83
+ ],
84
+ plugins: [
85
+ '@typescript-eslint',
86
+ 'html',
87
+ 'promise',
88
+ 'unused-imports',
89
+ 'sonarjs',
90
+ ],
91
+ // Shared configuration for rules
92
+ settings: {
93
+ 'import/resolver': {
94
+ node: {
95
+ extensions: ['.js', '.jsx', '.mjs', 'cjs', '.ts', '.tsx', '.d.ts'],
96
+ },
97
+ },
98
+ },
99
+ rules: {
100
+ /** General Code Rules **/
101
+ // Handled by unused-imports/no-unused-imports
102
+ '@typescript-eslint/no-unused-vars': 'off',
103
+ 'no-redeclare': 'off',
104
+ '@typescript-eslint/no-redeclare': [
105
+ 'error',
106
+ { ignoreDeclarationMerge: true },
107
+ ],
108
+ // 'n/no-missing-import': 0,
109
+ // 'n/no-missing-require': 0,
110
+ // Enforce import order
111
+ 'import/order': 'error',
112
+ // Imports should come first
113
+ 'import/first': 'error',
114
+ // Exporting mutable variables
115
+ 'import/no-mutable-exports': 'error',
116
+ // Allow unresolved imports
117
+ 'import/no-unresolved': 'off',
118
+ // Allow debugger during development
119
+ 'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'warn',
120
+ // 'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'warn',
121
+ // Prefer const over let
122
+ 'prefer-const': [
123
+ 'error',
124
+ {
125
+ destructuring: 'any',
126
+ ignoreReadBeforeAssign: false,
127
+ },
128
+ ],
129
+ // No single if in an "else" block
130
+ 'no-lonely-if': 'error',
131
+ // Force curly braces for control flow, including if blocks with a single statement
132
+ curly: ['error', 'all'],
133
+ // No async function without await
134
+ 'require-await': 'error',
135
+ // Force dot notation when possible
136
+ 'dot-notation': 1,
137
+ // Warn for void usage
138
+ 'no-void': 1,
139
+ 'no-var': 'error',
140
+ // Force object shorthand where possible
141
+ 'object-shorthand': 'error',
142
+ // No useless destructuring/importing/exporting renames
143
+ 'no-useless-rename': 'error',
144
+ // Per the docs, the root no-unused-vars should be disabled:
145
+ // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-unused-vars.md
146
+ // '@typescript-eslint/no-unused-vars': ['error', { args: 'all', argsIgnorePattern: '^_' }],
147
+ 'no-unused-vars': 'off',
148
+ // https://github.com/typescript-eslint/typescript-eslint/blob/1cf9243/docs/getting-started/linting/FAQ.md#i-get-errors-from-the-no-undef-rule-about-global-variables-not-being-defined-even-though-there-are-no-typescript-errors
149
+ 'no-undef': 'off',
150
+
151
+ /** Formatting (not handled by Prettier) **/
152
+ // Deprecated
153
+ 'newline-before-return': 'off',
154
+ // Deprecated
155
+ 'newline-after-var': 'off',
156
+ // https://eslint.org/docs/latest/rules/padding-line-between-statements
157
+ 'padding-line-between-statements': [
158
+ 'error',
159
+ { blankLine: 'always', prev: 'var', next: 'return' },
160
+ { blankLine: 'always', prev: 'var', next: 'block' },
161
+ { blankLine: 'always', prev: 'block', next: 'return' },
162
+ ],
163
+
164
+ /** Performance Tweaks for ESLint ***/
165
+ // https://github.com/typescript-eslint/typescript-eslint/blob/main/docs/linting/TROUBLESHOOTING.md#eslint-plugin-import
166
+ indent: 0,
167
+ '@typescript-eslint/indent': 0,
168
+ // Disable to increase eslint performance as TypeScript covers its usecase
169
+ 'import/no-named-as-default-member': 0,
170
+ // Disable to increase eslint performance as TypeScript covers its usecase
171
+ 'import/default': 0,
172
+ // Allow unverifiable namespaces of imports
173
+ // Disable to increase eslint performance as TypeScript covers its usecase
174
+ 'import/namespace': 0,
175
+ // Name imports result sometimes in errors, as type definitions are incomplete
176
+ // Disable to increase eslint performance as TypeScript covers its usecase
177
+ 'import/named': 0,
178
+ 'import/no-named-as-default': 0,
179
+
180
+ /** Additional Rule Tweaks **/
181
+ 'eslint-comments/no-unlimited-disable': 1,
182
+ // Use node internals and types to check for extraneous imports of dependencies
183
+ // https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-extraneous-dependencies.md
184
+ 'import/no-extraneous-dependencies': [
185
+ 'error',
186
+ { includeInternal: true, includeTypes: true },
187
+ ],
188
+
189
+ /** Prettier Compatibility **/
190
+ 'space-before-function-paren': 0,
191
+
192
+ /** Disallowed Imports **/
193
+ 'no-restricted-imports': [
194
+ 'error',
195
+ // Forbid importing "Lodash" package since it's replaced with "Radash"
196
+ {
197
+ paths: [
198
+ {
199
+ name: 'lodash',
200
+ message: 'Usage radash instead of lodash ',
201
+ },
202
+ ],
203
+ patterns: [
204
+ {
205
+ group: ['lodash/*', 'lodash-es/*'],
206
+ message: 'Usage radash instead of lodash',
207
+ },
208
+ ],
209
+ },
210
+ ],
211
+ },
212
+ overrides: [
213
+ {
214
+ files: ['*.ts', '*.tsx'],
215
+ parser: '@typescript-eslint/parser',
216
+ },
217
+ {
218
+ files: ['*.ts', '*.tsx', '*.mts', '*.cts', '*.vue'],
219
+ rules: {
220
+ // The rule `no-unused-vars` of `eslint:recommended`
221
+ // does not work with TypeScripts type definitions.
222
+ // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-unused-vars.md
223
+ 'no-unused-vars': 'off',
224
+ // https://github.com/typescript-eslint/typescript-eslint/blob/1cf9243/docs/getting-started/linting/FAQ.md#i-get-errors-from-the-no-undef-rule-about-global-variables-not-being-defined-even-though-there-are-no-typescript-errors
225
+ 'no-undef': 'off',
226
+ '@typescript-eslint/no-unused-vars': [
227
+ 'error',
228
+ { varsIgnorePattern: '^_', argsIgnorePattern: '^_' },
229
+ ],
230
+ },
231
+ },
232
+ {
233
+ // TypeScript Definitions specific overrides
234
+ files: ['*.d.ts'],
235
+ rules: {
236
+ 'import/no-duplicates': 'off',
237
+ },
238
+ },
239
+ ],
240
+ }
package/nuxt/nuxt.cjs ADDED
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Shared eslint config for Vue3
3
+ * https://eslint.org/docs/latest/
4
+ *
5
+ */
6
+
7
+ /** @type {import('eslint').ESLint.ConfigData} */
8
+ module.exports = {
9
+ extends: [
10
+ '../config/eslint-config-vue-base.cjs',
11
+ 'plugin:vue/vue3-recommended',
12
+ ],
13
+ rules: {
14
+ 'vue/no-reserved-component-names': 'error',
15
+ },
16
+ overrides: [
17
+ {
18
+ // Pages and layouts are required to have a single root element if transitions are enabled.
19
+ // https://github.com/nuxt/eslint-config/blob/main/packages/eslint-config/index.js#L77
20
+ files: [
21
+ '**/pages/**/*.{js,ts,jsx,tsx,vue}',
22
+ '**/layouts/**/*.{js,ts,jsx,tsx,vue}',
23
+ ],
24
+ rules: { 'vue/no-multiple-template-root': 'error' },
25
+ },
26
+ ],
27
+ }
package/nuxt/nuxt2.cjs ADDED
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Shared eslint config for Vue2
3
+ * https://eslint.org/docs/latest/
4
+ *
5
+ */
6
+
7
+ /** @type {import('eslint').ESLint.ConfigData} */
8
+ module.exports = {
9
+ extends: ['../config/eslint-config-vue-base.cjs', 'plugin:vue/recommended'],
10
+ rules: {
11
+ 'vue/no-reserved-component-names': 'error',
12
+ },
13
+ overrides: [
14
+ {
15
+ // Pages and layouts are required to have a single root element if transitions are enabled.
16
+ // https://github.com/nuxt/eslint-config/blob/main/packages/eslint-config/index.js#L77
17
+ files: [
18
+ '**/pages/**/*.{js,ts,jsx,tsx,vue}',
19
+ '**/layouts/**/*.{js,ts,jsx,tsx,vue}',
20
+ ],
21
+ rules: { 'vue/no-multiple-template-root': 'error' },
22
+ },
23
+ ],
24
+ }
package/package.json ADDED
@@ -0,0 +1,66 @@
1
+ {
2
+ "name": "@scayle/eslint-config-storefront",
3
+ "version": "3.2.5",
4
+ "description": "SCAYLE Commerce Engine specific eslint configuration",
5
+ "author": "SCAYLE Commerce Engine",
6
+ "license": "MIT",
7
+ "publishConfig": {
8
+ "access": "public",
9
+ "registry": "https://registry.npmjs.org/"
10
+ },
11
+ "exports": {
12
+ ".": "./index.js",
13
+ "./nuxt/nuxt2": "./nuxt/nuxt2.cjs",
14
+ "./nuxt/nuxt": "./nuxt/nuxt.cjs",
15
+ "./config/eslint-config-yml.cjs": "./config/eslint-config-yml.cjs",
16
+ "./config/eslint-config-json.cjs": "./config/eslint-config-json.cjs",
17
+ "./config/eslint-config-vue-base.cjs": "./config/eslint-config-vue-base.cjs"
18
+ },
19
+ "main": "./index.js",
20
+ "files": [
21
+ "CHANGELOG.md",
22
+ "./index.js",
23
+ "./config/",
24
+ "./nuxt/"
25
+ ],
26
+ "scripts": {
27
+ "format": "prettier --ignore-unknown --log-level warn --check .",
28
+ "format:fix": "prettier --ignore-unknown --log-level warn --write .",
29
+ "lint": "eslint . --format gitlab",
30
+ "lint:fix": "eslint . --fix",
31
+ "package:lint": "publint"
32
+ },
33
+ "peerDependencies": {
34
+ "eslint": "8.52.0"
35
+ },
36
+ "dependencies": {
37
+ "@rushstack/eslint-patch": "1.5.1",
38
+ "@typescript-eslint/eslint-plugin": "6.9.1",
39
+ "@typescript-eslint/parser": "6.9.1",
40
+ "eslint-config-prettier": "9.0.0",
41
+ "eslint-config-standard": "17.1.0",
42
+ "eslint-plugin-eslint-comments": "3.2.0",
43
+ "eslint-plugin-html": "7.1.0",
44
+ "eslint-plugin-import": "2.29.0",
45
+ "eslint-plugin-n": "16.2.0",
46
+ "eslint-plugin-no-unsanitized": "4.0.2",
47
+ "eslint-plugin-nuxt": "4.0.0",
48
+ "eslint-plugin-promise": "6.1.1",
49
+ "eslint-plugin-sonarjs": "0.21.0",
50
+ "eslint-plugin-unicorn": "49.0.0",
51
+ "eslint-plugin-unused-imports": "3.0.0",
52
+ "eslint-plugin-vue": "9.18.1",
53
+ "eslint-plugin-yml": "1.10.0",
54
+ "jsonc-eslint-parser": "2.4.0",
55
+ "typescript": "5.2.2",
56
+ "yaml-eslint-parser": "1.2.2"
57
+ },
58
+ "devDependencies": {
59
+ "@scayle/prettier-config-storefront": "2.0.2",
60
+ "@types/eslint": "8.44.6",
61
+ "eslint": "8.52.0",
62
+ "eslint-formatter-gitlab": "5.0.0",
63
+ "prettier": "3.0.0",
64
+ "publint": "0.2.5"
65
+ }
66
+ }