@soleil-se/eslint-config 6.0.2 → 6.2.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.
package/CHANGELOG.md CHANGED
@@ -2,192 +2,205 @@
2
2
  title: Changelog
3
3
  ---
4
4
 
5
- Alla förändringar i detta repository antecknas här.
5
+ All changes in this repository are noted here.
6
6
 
7
- Formatet baseras [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
8
- och projektet använder [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
8
+ and the project uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
9
+
10
+ ## [6.2.0] - 2025-03-31
11
+
12
+ * Update `eslint-plugin-svelte` version 3.
13
+ * Enable `svelte/html-self-closing`.
14
+ * Enable `svelte/prefer-const`.
15
+ * Allow caught errors to unused in `no-unused-vars`.
16
+ * Add path group override for `#` in `import/extensions`.
17
+
18
+ ## [6.1.0] - 2025-03-18
19
+
20
+ * Adjust config for script modules to correct sourceType.
21
+ * Allow `underscore-dangle` for `__rekai`.
9
22
 
10
23
  ## [6.0.2] - 2025-02-07
11
24
 
12
- * Uppdatera definitioner i package.json.
25
+ * Update definitions in package.json.
13
26
 
14
27
  ## [6.0.1] - 2025-02-05
15
28
 
16
- * Läs in Svelte konfiguration dynamiskt.
17
- * Uppdatera referenser för publicering npm.
29
+ * Load Svelte configuration dynamically.
30
+ * Update references for publishing on npm.
18
31
 
19
32
  ## [6.0.0] - 2025-02-04
20
33
 
21
- * Uppdatera till ESLint 9 och format konfigurationsfiler till flat config.
22
- * Ändra `trailingComma` till 'all' i Prettier-konfigurationen.
23
- * Lägg till global för `envision`.
24
- * Döpt om `legacy` till `script-module` det är det den används till.
34
+ * Update to ESLint 9 and format configuration files to flat config.
35
+ * Change `trailingComma` to 'all' in the Prettier configuration.
36
+ * Add global for `envision`.
37
+ * Renamed `legacy` to `script-module-config` as that is what it is used for.
25
38
 
26
39
  ## [5.3.2] - 2024-12-13
27
40
 
28
- * Stäng av regeln `svelte/no-unused-svelte-ignore` den strular.
41
+ * Turn off the rule `svelte/no-unused-svelte-ignore` as it causes issues.
29
42
 
30
43
  ## [5.3.1] - 2024-11-15
31
44
 
32
- * Ta bort `svelte-preprocess` från dependencies det inte är relevant för eslint.
45
+ * Remove `svelte-preprocess` from the installation script as it is not relevant for eslint.
33
46
 
34
47
  ## [5.3.0] - 2024-10-21
35
48
 
36
- * Justerat regler för `prefer-const` och `max-len` för att fungera bättre med Svelte 5.
49
+ * Adjust rules for `prefer-const` and `max-len` to work better with Svelte 5.
37
50
 
38
51
  ## [5.2.0] - 2024-06-03
39
52
 
40
- * Nytt kommando för att installera dependencies och skapa konfigurationsfiler, `npx @soleil/eslint-config-sitevision --setup`.
53
+ * New command to install dependencies and create configuration files, `npx @soleil/eslint-config --setup`.
41
54
 
42
55
  ## [5.1.2] - 2023-10-26
43
56
 
44
- - Uppdatera inställningarna för `max-len` i Svelte-filer det bråkar med prettier.
57
+ - Update settings for `max-len` in Svelte files as it conflicts with prettier.
45
58
 
46
59
  ## [5.1.1] - 2023-08-22
47
60
 
48
- - Lägg till undantag för Sveltes submoduler import-pluginet inte kan resolva dessa trots att de finns tillgängliga.
61
+ - Add exceptions for Svelte's submodules as the import plugin cannot resolve these even though they are available.
49
62
 
50
63
  ## [5.1.0] - 2023-06-01
51
64
 
52
- - Lägg till varningar för API:er vars instanser inte borde importeras direkt utan skapas via andra API:er.
65
+ - Add warnings for APIs whose instances should not be imported directly but created via other APIs.
53
66
 
54
67
  ## [5.0.1] - 2023-05-31
55
68
 
56
- - Ignorera `max-len` för importer i style taggar i Svelte komponenter.
69
+ - Ignore `max-len` for imports in style tags in Svelte components.
57
70
 
58
71
  ## [5.0.0] - 2023-05-26
59
72
 
60
- - Nytt plugin för linting av Svelte.
73
+ - New plugin for linting Svelte.
61
74
 
62
75
  ## [4.0.1] - 2023-03-27
63
76
 
64
- - Läs bara in overrides för Svelte-filer när Svelte är installerat i projektet.
77
+ - Only load overrides for Svelte files when Svelte is installed in the project.
65
78
 
66
79
  ## [4.0.0] - 2022-06-22
67
80
 
68
- - Förenkla genom att ta bort de de olika konfigurationerna och använd en och samma config för allt utom legacy kod.
69
- - Modernisera legacy konfigurationen för att tillåta begränsad användning av ES2015+ som stöds av Rhino.
70
- - Använd `eslint-config-prettier` i Svelte komponenter för att undvika krockar med ESLint.
71
- - Ta bort stöd för Vue.
81
+ - Simplify by removing the different configurations and using the same config for everything except legacy code.
82
+ - Modernize the legacy configuration to allow limited use of ES2015+ supported by Rhino.
83
+ - Use `eslint-config-prettier` in Svelte components to avoid conflicts with ESLint.
84
+ - Remove support for Vue.
72
85
 
73
86
  ## [3.1.0] - 2022-04-11
74
87
 
75
- - Tillåt användning av `console.error()` - för exempelvis try catch.
88
+ - Allow the use of `console.error()` - for example, in try catch.
76
89
 
77
90
  ## [3.0.1] - 2022-02-07
78
91
 
79
- - Ignorera `import/no-unresolved` för importer som börjar med `@sitevision/api/server`,
80
- `@sitevision/api/common` och `@sitevision/api/client` alla API:er inte finns dokumenterade.
92
+ - Ignore `import/no-unresolved` for imports starting with `@sitevision/api/server`,
93
+ `@sitevision/api/common` and `@sitevision/api/client` as not all APIs are documented.
81
94
 
82
95
  ## [3.0.0] - 2022-02-07
83
96
 
84
- - Tillåt enbart importer av Sitevisions API:er via `@sitevision/api`.
85
- - Uppdaterat sökvägarna i den globala och webapp configen för att stödja WebApps 2 strukturen.
86
- - Uppdaterat `peerDependencies` till senaste major versionerna.
97
+ - Only allow imports of Sitevision's APIs via `@sitevision/api`.
98
+ - Update paths in the global and webapp config to support the WebApps 2 structure.
99
+ - Update `peerDependencies` to the latest major versions.
87
100
 
88
101
  ## [2.4.5] - 2021-11-04
89
102
 
90
- - Sätt `ecmaVersion` till 2021 i client kontfigurationen om Vue används.
103
+ - Set `ecmaVersion` to 2021 in the client configuration if Vue is used.
91
104
 
92
105
  ## [2.4.4] - 2021-09-09
93
106
 
94
- - Lägg till `options` i `svelteSortOrder`.
107
+ - Add `options` to `svelteSortOrder`.
95
108
 
96
109
  ## [2.4.3] - 2021-08-27
97
110
 
98
- - Felstavning i regeln `no-return-assign` i Svelte-filer.
111
+ - Typo in the rule `no-return-assign` in Svelte files.
99
112
 
100
113
  ## [2.4.2] - 2021-08-17
101
114
 
102
- - Om Vue används i projektet sätt `ecmaVersion` till 2021 istället pluginet använder Espree vilket inte klarar av samma versionsnamn som ESLint.
115
+ - If Vue is used in the project, set `ecmaVersion` to 2021 instead as the plugin uses Espree which cannot handle the same version names as ESLint.
103
116
 
104
117
  ## [2.4.1] - 2021-08-17
105
118
 
106
- - Sätt `ecmaVersion` till `latest` för att slippa uppdatera version varje år.
119
+ - Set `ecmaVersion` to `latest` to avoid updating the version every year.
107
120
 
108
121
  ## [2.4.0] - 2021-03-24
109
122
 
110
- - Meddelande av deprekering för konfigurationerna `@soleil/eslint-config-sitevision/universal` och `@soleil/eslint-config-sitevision/server`
111
- - Nya konfigurationer med tydligare namn: `@soleil/eslint-config-sitevision/webapp` och `@soleil/eslint-config-sitevision/server-legacy`
112
- - Tillåt fler properties per rad i ett objekt i `object-curly-newline`.
123
+ - Deprecation notice for the configurations `@soleil/eslint-config/universal` and `@soleil/eslint-config/server`
124
+ - New configurations with clearer names: `@soleil/eslint-config/webapp` and `@soleil/eslint-config/server-legacy`
125
+ - Allow more properties per line in an object in `object-curly-newline`.
113
126
 
114
127
  ## [2.3.1] - 2021-02-24
115
128
 
116
- - Dra tillbaka till `ecmaVersion` till 2020.
129
+ - Revert `ecmaVersion` to 2020.
117
130
 
118
131
  ## [2.3.0] - 2021-02-24
119
132
 
120
- - Fler regler överlappar när man skriver universell kod.
121
- - Slagit av `import/prefer-default-export`.
122
- - Slagit av `no-return-assig` i Svelte komponenter.
123
- - Tagit bort linting av skript i HTML för server konfigurationen för ES5-kod.
133
+ - More rules overlap when writing universal code.
134
+ - Turned off `import/prefer-default-export`.
135
+ - Turned off `no-return-assign` in Svelte components.
136
+ - Removed linting of scripts in HTML for the server configuration for ES5 code.
124
137
 
125
138
  ## [2.2.1] - 2021-01-07
126
139
 
127
- - Tagit bort `babel-eslint` från dependencies.
140
+ - Removed `babel-eslint` from dependencies.
128
141
 
129
142
  ## [2.2.0] - 2021-01-07
130
143
 
131
- - Tagit bort `babel-eslint` och använder standardparsern med ES2020.
132
- - Förenklat `svelte.config.js`, oftast behövs inte plugin för globbing.
133
- - Lagt till paketet `cache` som undantag för SiteVision paket.
144
+ - Removed `babel-eslint` and use the standard parser with ES2020.
145
+ - Simplified `svelte.config.js`, usually the plugin for globbing is not needed.
146
+ - Added the package `cache` as an exception for SiteVision packages.
134
147
 
135
148
  ## [2.1.4] - 2020-10-26
136
149
 
137
- - Tagit bort felaktig konfiguration av `a11y-no-onchange`.
150
+ - Removed incorrect configuration of `a11y-no-onchange`.
138
151
 
139
152
  ## [2.1.3] - 2020-10-21
140
153
 
141
- - Lagt till `app_src/views/**/*.js` i server configen.
154
+ - Added `app_src/views/**/*.js` in the server config.
142
155
 
143
156
  ## [2.1.2] - 2020-10-06
144
157
 
145
- - Åträgrdat felaktiga `parserOptions` i `server-es6` configen.
158
+ - Fixed incorrect `parserOptions` in the `server-es6` config.
146
159
 
147
160
  ## [2.1.1] - 2020-10-06
148
161
 
149
- - Ändrat ordning config de inställningar Svelte behöver för serversidan kommer med.
162
+ - Changed the order of the config so the settings Svelte needs for the server side are included.
150
163
 
151
164
  ## [2.1.0] - 2020-09-28
152
165
 
153
- - Dependencies som behövs som standard ligger som peerDependencies
154
- - Dependencies för ramverksspecifika plugins behöver installeras utöver peerDependencies.
166
+ - Dependencies needed by default are listed as peerDependencies.
167
+ - Dependencies for framework-specific plugins need to be installed in addition to peerDependencies.
155
168
 
156
169
  ## [2.0.0] - 2020-09-28
157
170
 
158
- - Stöd för Svelte.
159
- - Uppdaterad struktur.
160
- - Uppdatering till ESLint 7.
161
- - Tagit bort konfigurationen för Vue, ligger nu i client.
171
+ - Support for Svelte.
172
+ - Updated structure.
173
+ - Update to ESLint 7.
174
+ - Removed the configuration for Vue, now in the client.
162
175
 
163
176
  ## [1.1.2] - 2020-02-05
164
177
 
165
- - Ändrat regeln `import/extensions` den ignorerar json-filer.
178
+ - Changed the rule `import/extensions` to ignore json files.
166
179
 
167
180
  ## [1.1.1] - 2020-01-27
168
181
 
169
- - Ändrat regeln `import/extensions` den ignorerar vue-filer.
182
+ - Changed the rule `import/extensions` to ignore vue files.
170
183
 
171
184
  ## [1.1.0] - 2020-01-21
172
185
 
173
- - Ändrat regeln `import/extensions` den ignorerar paket, löser problem med import via alias.
186
+ - Changed the rule `import/extensions` to ignore packages, solving issues with import via alias.
174
187
 
175
188
  ## [1.0.0] - 2020-01-13
176
189
 
177
- - Uppdaterat till ESLint 6.
190
+ - Updated to ESLint 6.
178
191
 
179
192
  ## [0.3.3] - 2019-12-06
180
193
 
181
- - Det får nu vara max 3 attribut per rad i Vue (`vue/max-attributes-per-line`).
194
+ - Now allows a maximum of 3 attributes per line in Vue (`vue/max-attributes-per-line`).
182
195
 
183
196
  ## [0.3.2] - 2019-06-03
184
197
 
185
- - Lagt till `server_src/api` i server den globala configen.
198
+ - Added `server_src/api` in the server to the global config.
186
199
 
187
200
  ## [0.3.1] - 2019-05-20
188
201
 
189
- - Slagit av `global-require` för att kunna skriva `require` innanför IIFE i `src/index.js` i en WebApp.
202
+ - Turned off `global-require` to allow writing `require` inside IIFE in `src/index.js` in a WebApp.
190
203
 
191
204
  ## [0.3.0] - 2019-05-20
192
205
 
193
- - Lagt till en global config som kan användas i roten av ett projekt som använder standardstrukturen och `@soleil/sv-gulp-build@^3.0.0`.
206
+ - Added a global config that can be used in the root of a project using the standard structure and `@soleil/sv-gulp-build@^3.0.0`.
package/README.md CHANGED
@@ -2,4 +2,4 @@
2
2
 
3
3
  ESLint configuration for Sitevision apps and projects.
4
4
 
5
- [Documentation](https://docs.soleil.se/packages/eslint-config)
5
+ [Documentation](https://docs.soleil.se/packages/eslint-config) | [Changelog](https://docs.soleil.se/packages/eslint-config/changelog)
package/config/base.js ADDED
@@ -0,0 +1,30 @@
1
+ import globals from 'globals';
2
+ import importPlugin from 'eslint-plugin-import';
3
+ import jsRules from '../rules/js/index.js';
4
+
5
+ export default function base() {
6
+ return [{
7
+ name: 'soleil/base',
8
+ languageOptions: {
9
+ ecmaVersion: 'latest',
10
+ sourceType: 'module',
11
+ globals: {
12
+ process: 'readonly',
13
+ Packages: 'readonly',
14
+ envision: 'readonly',
15
+ ...globals.browser,
16
+ },
17
+ },
18
+ ignores: ['dist', 'node_modules', 'prettier.config.js'],
19
+ plugins: { import: importPlugin },
20
+ rules: jsRules,
21
+ settings: {
22
+ svelte: {
23
+ // Ignore max-len in template and style, still works for script tags.
24
+ ignoreWarnings: [
25
+ 'max-len',
26
+ ],
27
+ },
28
+ },
29
+ }];
30
+ }
@@ -0,0 +1,31 @@
1
+ import svelteRules from '../rules/svelte/index.js';
2
+
3
+ async function hasSvelte() {
4
+ try {
5
+ await import('svelte');
6
+ return true;
7
+ } catch (e) {
8
+ return false;
9
+ }
10
+ }
11
+
12
+ export default async function svelte() {
13
+ if (!await hasSvelte()) return [];
14
+
15
+ const { default: eslintPluginSvelte } = await import('eslint-plugin-svelte');
16
+ const { default: eslintConfigPrettier } = await import('eslint-config-prettier');
17
+
18
+ return [
19
+ ...eslintPluginSvelte.configs.recommended,
20
+ ...eslintPluginSvelte.configs.prettier,
21
+ {
22
+ name: 'soleil/svelte',
23
+ files: ['**/*.svelte', '**/*.svelte.js', '**/*.svelte.ts'],
24
+ rules: svelteRules,
25
+ }, {
26
+ name: 'soleil/svelte.prettier',
27
+ files: ['**/*.svelte'],
28
+ rules: eslintConfigPrettier.rules,
29
+ },
30
+ ];
31
+ }
package/eslint.config.js CHANGED
@@ -2,4 +2,9 @@ import config from './node-config.js';
2
2
 
3
3
  export default [
4
4
  ...config,
5
+ {
6
+ rules: {
7
+ 'import/no-extraneous-dependencies': 0,
8
+ },
9
+ },
5
10
  ];
package/index.js CHANGED
@@ -1,70 +1,7 @@
1
- import globals from 'globals';
2
- import importPlugin from 'eslint-plugin-import';
3
-
4
- import jsRules from './rules/js/index.js';
5
- import svelteRules from './rules/svelte/index.js';
6
-
7
- function loadSvelteConfig() {
8
- // eslint-disable-next-line import/no-extraneous-dependencies
9
- return import('svelte').then(async () => {
10
- const { default: eslintPluginSvelte } = await import('eslint-plugin-svelte');
11
- const { default: eslintConfigPrettier } = await import('eslint-config-prettier');
12
- return [
13
- ...eslintPluginSvelte.configs['flat/recommended'],
14
- ...eslintPluginSvelte.configs['flat/prettier'],
15
- {
16
- name: 'soleil/svelte',
17
- files: ['**/*.svelte'],
18
- rules: {
19
- ...svelteRules,
20
- ...eslintConfigPrettier.rules,
21
- },
22
- }, {
23
- name: 'soleil/svelte.js',
24
- files: ['**/*.svelte.js', '**/*.svelte.ts'],
25
- languageOptions: {
26
- ecmaVersion: 'latest',
27
- sourceType: 'module',
28
- globals: {
29
- $state: 'readonly',
30
- $derived: 'readonly',
31
- $effect: 'readonly',
32
- $inspect: 'readonly',
33
- },
34
- },
35
- rules: {
36
- // Do not enforce const because of reactivity for runes in Svelte 5.
37
- 'prefer-const': 0,
38
- },
39
- },
40
- ];
41
- }).catch(() => []);
42
- }
1
+ import base from './config/base.js';
2
+ import svelte from './config/svelte.js';
43
3
 
44
4
  export default [
45
- {
46
- name: 'soleil/base',
47
- languageOptions: {
48
- ecmaVersion: 'latest',
49
- sourceType: 'module',
50
- globals: {
51
- process: 'readonly',
52
- Packages: 'readonly',
53
- envision: 'readonly',
54
- ...globals.browser,
55
- },
56
- },
57
- ignores: ['dist', 'node_modules', 'prettier.config.js'],
58
- plugins: { import: importPlugin },
59
- rules: jsRules,
60
- settings: {
61
- svelte: {
62
- // Ignore max-len in template and style, still works for script tags.
63
- ignoreWarnings: [
64
- 'max-len',
65
- ],
66
- },
67
- },
68
- },
69
- ...await loadSvelteConfig(),
5
+ ...base(),
6
+ ...await svelte(),
70
7
  ];
package/node-config.js CHANGED
@@ -1,9 +1,11 @@
1
- import config from './index.js';
1
+ import base from './config/base.js';
2
2
 
3
- export default [...config, {
4
- rules: {
5
- 'import/extensions': ['error', 'ignorePackages', {
6
- js: 'always',
7
- }],
8
- },
9
- }];
3
+ export default [
4
+ ...base(),
5
+ {
6
+ rules: {
7
+ 'import/extensions': ['error', 'ignorePackages', {
8
+ js: 'always',
9
+ }],
10
+ },
11
+ }];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@soleil-se/eslint-config",
3
- "version": "6.0.2",
3
+ "version": "6.2.0",
4
4
  "description": "ESLint configuration for Sitevision apps and projects.",
5
5
  "keywords": [
6
6
  "eslint",
@@ -19,17 +19,21 @@
19
19
  "./prettier": "./prettier.js",
20
20
  "./script-module": "./script-module.js",
21
21
  "./node": "./node-config.js",
22
- "./rules":"./rules/**/*.js"
22
+ "./typescript": "./typescript.js",
23
+ "./config/base": "./config/base.js",
24
+ "./config/svelte": "./config/svelte.js",
25
+ "./rules/js":"./rules/js/index.js",
26
+ "./rules/svelte":"./rules/svelte/index.js"
23
27
  },
24
28
  "dependencies": {
25
- "eslint-config-prettier": "^10.0.1",
29
+ "eslint-config-prettier": "^10.1.1",
26
30
  "eslint-plugin-import": "^2.31.0",
27
- "eslint-plugin-svelte": "^2.46.1",
28
- "globals": "^15.14.0"
31
+ "eslint-plugin-svelte": "^3.4.0",
32
+ "globals": "^16.0.0"
29
33
  },
30
34
  "devDependencies": {
31
- "eslint": "^9.18.0",
32
- "svelte": "^5.17.4"
35
+ "eslint": "^9.23.0",
36
+ "svelte": "^5.25.3"
33
37
  },
34
38
  "peerDependencies": {
35
39
  "eslint": ">= 9"
@@ -89,11 +89,24 @@ export default {
89
89
 
90
90
  // Ensure consistent use of file extension within the import path
91
91
  // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/extensions.md
92
- 'import/extensions': ['error', 'ignorePackages', {
93
- js: 'never',
94
- mjs: 'never',
95
- jsx: 'never',
96
- }],
92
+
93
+ 'import/extensions': ['error', {
94
+ ignorePackages: true,
95
+ pattern: {
96
+ js: 'never',
97
+ mjs: 'never',
98
+ jsx: 'never',
99
+ json: 'always',
100
+ },
101
+ pathGroupOverrides: [{
102
+ pattern: '**/*.svelte.js',
103
+ action: 'ignore',
104
+ }, {
105
+ pattern: '#*',
106
+ action: 'ignore',
107
+ }],
108
+ },
109
+ ],
97
110
 
98
111
  // ensure absolute imports are above relative imports and that unassigned imports are ignored
99
112
  // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/order.md
package/rules/js/style.js CHANGED
@@ -372,7 +372,7 @@ export default {
372
372
  // disallow dangling underscores in identifiers
373
373
  // https://eslint.org/docs/rules/no-underscore-dangle
374
374
  'no-underscore-dangle': ['error', {
375
- allow: [],
375
+ allow: ['__rekai'],
376
376
  allowAfterThis: false,
377
377
  allowAfterSuper: false,
378
378
  enforceInMethodNames: true,
@@ -109,7 +109,7 @@ export default {
109
109
  'no-undefined': 'off',
110
110
 
111
111
  // disallow declaration of variables that are not used in the code
112
- 'no-unused-vars': ['error', { vars: 'all', args: 'after-used', ignoreRestSiblings: true }],
112
+ 'no-unused-vars': ['error', { vars: 'all', args: 'after-used', ignoreRestSiblings: true, caughtErrors: 'none' }],
113
113
 
114
114
  // disallow use of variables before they are defined
115
115
  'no-use-before-define': ['error', { functions: true, classes: true, variables: true }],
@@ -5,4 +5,5 @@ export default {
5
5
  'svelte/no-reactive-literals': 'warn',
6
6
  'svelte/no-useless-mustaches': 'warn',
7
7
  'svelte/no-unused-svelte-ignore': 0,
8
+ 'svelte/prefer-const': 'error',
8
9
  };
@@ -1,6 +1,47 @@
1
1
  export default {
2
2
  'svelte/no-extra-reactive-curlies': 'warn',
3
3
  'svelte/prefer-style-directive': 'warn',
4
- 'svelte/sort-attributes': 'warn',
5
4
  'svelte/spaced-html-comment': 'warn',
5
+ 'svelte/html-self-closing': 'warn',
6
+ 'svelte/html-quotes': 'warn',
7
+ 'svelte/sort-attributes': [
8
+ 'warn', {
9
+ order: [
10
+ // `this` property.
11
+ 'this',
12
+ // `bind:this` directive.
13
+ 'bind:this',
14
+ // `id` attribute.
15
+ 'id',
16
+ // `name` attribute.
17
+ 'name',
18
+ // `slot` attribute.
19
+ 'slot',
20
+ // `--style-props` (Alphabetical order within the same group.)
21
+ { match: '/^--/u', sort: 'alphabetical' },
22
+ // `style` attribute, and `style:` directives.
23
+ ['style', '/^style:/u'],
24
+ // `class` attribute.
25
+ 'class',
26
+ // `class:` directives. (Alphabetical order within the same group.)
27
+ { match: '/^class:/u', sort: 'alphabetical' },
28
+ // other attributes.
29
+ ['!/:/u', '!/^(?:this|id|name|style|class)$/u', '!/^--/u'],
30
+ // `bind:` directives (other then `bind:this`), and `on:` directives.
31
+ ['/^bind:/u', '!bind:this', '/^on:/u'],
32
+ // `use:` directives. (Alphabetical order within the same group.)
33
+ { match: '/^use:/u', sort: 'alphabetical' },
34
+ // `transition:` directive.
35
+ { match: '/^transition:/u', sort: 'alphabetical' },
36
+ // `in:` directive.
37
+ { match: '/^in:/u', sort: 'alphabetical' },
38
+ // `out:` directive.
39
+ { match: '/^out:/u', sort: 'alphabetical' },
40
+ // `animate:` directive.
41
+ { match: '/^animate:/u', sort: 'alphabetical' },
42
+ // `let:` directives. (Alphabetical order within the same group.)
43
+ { match: '/^let:/u', sort: 'alphabetical' },
44
+ ],
45
+ },
46
+ ],
6
47
  };
package/script-module.js CHANGED
@@ -5,11 +5,12 @@ import variables from './rules/js/variables.js';
5
5
 
6
6
  export default [
7
7
  {
8
- name: 'soleil/base',
8
+ name: 'soleil/script-module',
9
9
  languageOptions: {
10
10
  ecmaVersion: 'latest',
11
- sourceType: 'commonjs',
11
+ sourceType: 'script',
12
12
  globals: {
13
+ require: 'readonly',
13
14
  scriptVariables: 'readonly',
14
15
  Packages: 'readonly',
15
16
  request: 'readonly',
package/setup.js CHANGED
@@ -97,12 +97,12 @@ function setupFiles() {
97
97
  function setup() {
98
98
  printStartup();
99
99
  let packageFile = readJsonFileSync('./package.json');
100
- if (packageFile?.devDependencies?.eslint) {
101
- packageFile = removeDependencies(packageFile);
102
- }
100
+ packageFile = removeDependencies(packageFile);
101
+
103
102
  if (packageFile.type !== 'module') {
104
103
  packageFile.type = 'module';
105
104
  }
105
+
106
106
  writeJsonFileSync('./package.json', packageFile);
107
107
  installDependencies();
108
108
  setupFiles();
package/typescript.js ADDED
@@ -0,0 +1,22 @@
1
+ // eslint-disable-next-line import/no-unresolved
2
+ import tseslint from 'typescript-eslint';
3
+ import base from './config/base.js';
4
+ import svelte from './config/svelte.js';
5
+
6
+ const svelteTypescript = {
7
+ files: ['**/*.svelte', '**/*.svelte.js', '**/*.svelte.ts'],
8
+ languageOptions: {
9
+ parserOptions: {
10
+ projectService: true,
11
+ extraFileExtensions: ['.svelte'],
12
+ parser: tseslint.parser,
13
+ },
14
+ },
15
+ };
16
+
17
+ export default tseslint.config(
18
+ ...base(),
19
+ tseslint.configs.recommended,
20
+ ...await svelte(),
21
+ svelteTypescript,
22
+ );