@origin-1/eslint-config 1.4.0 → 1.6.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/lib/create-config.d.ts +2 -2
- package/lib/create-config.js +4 -4
- package/lib/normalize-version.d.ts +1 -1
- package/lib/normalize-version.js +1 -1
- package/lib/rules.js +1 -0
- package/package.json +4 -4
package/lib/create-config.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { type JSVersion, type TSVersion } from './normalize-version.js';
|
|
2
2
|
import type { Linter } from 'eslint';
|
|
3
|
-
export type ConfigData = Linter.
|
|
3
|
+
export type ConfigData = Linter.Config & LanguageConfigData;
|
|
4
4
|
export interface LanguageConfigData {
|
|
5
5
|
jsVersion?: JSVersion | undefined;
|
|
6
6
|
tsVersion?: TSVersion | undefined;
|
|
7
7
|
}
|
|
8
|
-
export declare function createConfig(...configDataList: ConfigData[]): Promise<Linter.
|
|
8
|
+
export declare function createConfig(...configDataList: ConfigData[]): Promise<Linter.Config[]>;
|
|
9
9
|
export { createConfig as createFlatConfig };
|
package/lib/create-config.js
CHANGED
|
@@ -124,7 +124,7 @@ async function createSingleFlatConfig(configData) {
|
|
|
124
124
|
const lang = getLanguage(configData);
|
|
125
125
|
if (lang != null) {
|
|
126
126
|
const languageOptions = { ...config.languageOptions };
|
|
127
|
-
let { ecmaVersion, parser } = languageOptions;
|
|
127
|
+
let { ecmaVersion, parser, parserOptions } = languageOptions;
|
|
128
128
|
let jsVersion;
|
|
129
129
|
let tsVersion;
|
|
130
130
|
switch (lang) {
|
|
@@ -137,10 +137,12 @@ async function createSingleFlatConfig(configData) {
|
|
|
137
137
|
tsVersion = (0, normalize_version_js_1.normalizeTSVersion)(rawTSVersion);
|
|
138
138
|
ecmaVersion ??= 'latest';
|
|
139
139
|
parser ??= await importParser('@typescript-eslint/parser');
|
|
140
|
+
parserOptions = { projectService: true, ...parserOptions };
|
|
140
141
|
break;
|
|
141
142
|
}
|
|
142
143
|
languageOptions.ecmaVersion = ecmaVersion;
|
|
143
144
|
languageOptions.parser = parser;
|
|
145
|
+
languageOptions.parserOptions = parserOptions;
|
|
144
146
|
const linterOptions = { ...config.linterOptions };
|
|
145
147
|
linterOptions.reportUnusedDisableDirectives ??= true;
|
|
146
148
|
const plugins = {};
|
|
@@ -148,9 +150,7 @@ async function createSingleFlatConfig(configData) {
|
|
|
148
150
|
addLanguageRules(lang, jsVersion, tsVersion, rules, rulePrefixes);
|
|
149
151
|
const pluginPromises = rulePrefixes.map(importPlugin);
|
|
150
152
|
const pluginList = await Promise.all(pluginPromises);
|
|
151
|
-
rulePrefixes.forEach((rulePrefix, index) => {
|
|
152
|
-
plugins[rulePrefix] = pluginList[index];
|
|
153
|
-
});
|
|
153
|
+
rulePrefixes.forEach((rulePrefix, index) => { plugins[rulePrefix] = pluginList[index]; });
|
|
154
154
|
config.languageOptions = languageOptions;
|
|
155
155
|
config.linterOptions = linterOptions;
|
|
156
156
|
config.plugins = Object.assign(plugins, config.plugins);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
declare const JS_VERSION_SET: Set<5 | 2015 | 2016 | 2017 | 2018 | 2019 | 2020 | 2021 | 2022 | 2023 | 2024>;
|
|
1
|
+
declare const JS_VERSION_SET: Set<5 | 2015 | 2016 | 2017 | 2018 | 2019 | 2020 | 2021 | 2022 | 2023 | 2024 | 2025>;
|
|
2
2
|
export type JSVersion = typeof JS_VERSION_SET extends Set<infer T> ? T : never;
|
|
3
3
|
export type TSVersion = 'latest' | `${number}.${number}.${number}` | `${number}.${number}.${number}-${string}`;
|
|
4
4
|
export declare function normalizeJSVersion(jsVersion?: JSVersion): JSVersion;
|
package/lib/normalize-version.js
CHANGED
|
@@ -7,7 +7,7 @@ exports.normalizeJSVersion = normalizeJSVersion;
|
|
|
7
7
|
exports.normalizeTSVersion = normalizeTSVersion;
|
|
8
8
|
const node_util_1 = require("node:util");
|
|
9
9
|
const semver_1 = __importDefault(require("semver"));
|
|
10
|
-
const JS_VERSION_SET = new Set([5, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023, 2024]);
|
|
10
|
+
const JS_VERSION_SET = new Set([5, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023, 2024, 2025]);
|
|
11
11
|
function normalizeJSVersion(jsVersion = 5) {
|
|
12
12
|
if (JS_VERSION_SET.has(jsVersion))
|
|
13
13
|
return jsVersion;
|
package/lib/rules.js
CHANGED
|
@@ -305,6 +305,7 @@ exports.RULES = {
|
|
|
305
305
|
'no-this-alias': 'off',
|
|
306
306
|
'no-unnecessary-boolean-literal-compare': ['error'],
|
|
307
307
|
'no-unnecessary-condition': ['error'],
|
|
308
|
+
'no-unnecessary-parameter-property-assignment': ['error'],
|
|
308
309
|
'no-unnecessary-qualifier': ['error'],
|
|
309
310
|
'no-unnecessary-template-expression': ['error'],
|
|
310
311
|
'no-unnecessary-type-arguments': ['error'],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@origin-1/eslint-config",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
4
4
|
"description": "ESLint configuration generator with Origin₁ presets",
|
|
5
5
|
"homepage": "https://github.com/origin-1/eslint-config#readme",
|
|
6
6
|
"license": "ISC",
|
|
@@ -10,15 +10,15 @@
|
|
|
10
10
|
"url": "git+https://github.com/origin-1/eslint-config.git"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@types/eslint": "
|
|
13
|
+
"@types/eslint": "9",
|
|
14
14
|
"semver": "^7.5.2"
|
|
15
15
|
},
|
|
16
16
|
"peerDependencies": {
|
|
17
17
|
"@eslint-community/eslint-plugin-eslint-comments": ">=4.1",
|
|
18
18
|
"@origin-1/eslint-plugin": ">=0.16",
|
|
19
19
|
"@stylistic/eslint-plugin": "^2.1",
|
|
20
|
-
"@typescript-eslint/eslint-plugin": "8.0
|
|
21
|
-
"@typescript-eslint/parser": "8.0
|
|
20
|
+
"@typescript-eslint/eslint-plugin": "^8.0",
|
|
21
|
+
"@typescript-eslint/parser": "^8.0",
|
|
22
22
|
"eslint": "^9.3",
|
|
23
23
|
"eslint-plugin-n": "17"
|
|
24
24
|
},
|