@bhsd/code-standard 2.7.0 → 3.1.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.
@@ -1093,7 +1093,6 @@ export const ignores = {
1093
1093
  },
1094
1094
  ],
1095
1095
  browser = getConfig({
1096
- 'es-x/no-array-prototype-findlast-findlastindex': 2,
1097
1096
  'es-x/no-array-prototype-toreversed': 2,
1098
1097
  'es-x/no-array-prototype-tosorted': 2,
1099
1098
  'es-x/no-array-prototype-tospliced': 2,
@@ -1122,7 +1121,6 @@ export const ignores = {
1122
1121
  'es-x/no-set-prototype-union': 2,
1123
1122
  'es-x/no-string-prototype-iswellformed': 2,
1124
1123
  'es-x/no-string-prototype-towellformed': 2,
1125
- 'unicorn/prefer-array-last-methods': 0,
1126
1124
  'unicorn/prefer-structured-clone': 0,
1127
1125
  }),
1128
1126
  browserES8 = getConfig({
@@ -1150,6 +1148,7 @@ export const ignores = {
1150
1148
  }),
1151
1149
  dist = getConfig({
1152
1150
  ...esX.configs['flat/restrict-to-es2022'].rules,
1151
+ 'es-x/no-array-prototype-findlast-findlastindex': 0,
1153
1152
  'es-x/no-iterator-prototype-flatmap': 0,
1154
1153
  }),
1155
1154
  distES8 = getConfig({
@@ -1167,10 +1166,11 @@ export const extend = (...args) => {
1167
1166
  if (args.some(arg => Array.isArray(arg))) {
1168
1167
  throw new TypeError('只支持传入单个配置对象,禁止传入配置数组!');
1169
1168
  }
1170
- const moreIgnores = args.filter(({files: f, ignores: i}) => !f && i),
1169
+ const isModule = Number(args.includes('module')),
1170
+ moreIgnores = args.filter(({files: f, ignores: i}) => !f && i),
1171
1171
  moreGeneral = args.filter(({files: f, rules, plugins}) => !f && (rules || plugins)),
1172
1172
  moreFiles = args.filter(({files: f}) => f);
1173
- if (moreIgnores.length + moreGeneral.length + moreFiles.length !== args.length) {
1173
+ if (isModule + moreIgnores.length + moreGeneral.length + moreFiles.length !== args.length) {
1174
1174
  throw new RangeError('传入的配置项只能是忽略项、通用规则项或文件规则项三种之一!');
1175
1175
  }
1176
1176
  return [
@@ -1181,6 +1181,16 @@ export const extend = (...args) => {
1181
1181
  ...json,
1182
1182
  ...yaml,
1183
1183
  ...ts,
1184
+ ...isModule
1185
+ ? [
1186
+ {
1187
+ files: ['**/*.js'],
1188
+ languageOptions: {
1189
+ sourceType: 'module',
1190
+ },
1191
+ },
1192
+ ]
1193
+ : [],
1184
1194
  ...moreFiles,
1185
1195
  ];
1186
1196
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bhsd/code-standard",
3
- "version": "2.7.0",
3
+ "version": "3.1.0",
4
4
  "homepage": "https://github.com/bhsd-harry/code-standard#readme",
5
5
  "bugs": {
6
6
  "url": "https://github.com/bhsd-harry/code-standard/issues"
@@ -8,11 +8,17 @@
8
8
  "license": "MIT",
9
9
  "author": "Bhsd",
10
10
  "files": [
11
- "*.[cm]js",
12
- "!eslint.config.mjs",
11
+ "*.js",
12
+ "!eslint.config.js",
13
13
  "markdownlint.json"
14
14
  ],
15
- "main": "eslint.mjs",
15
+ "main": "eslint.js",
16
+ "exports": {
17
+ ".": "./eslint.js",
18
+ "./stylelint": "./stylelintrc.js",
19
+ "./markdownlint": "./markdownlint.json"
20
+ },
21
+ "type": "module",
16
22
  "scripts": {
17
23
  "ls": "npm i --package-lock-only && npm ls --package-lock-only --all --omit=dev",
18
24
  "lint:ts": "eslint --cache .",
@@ -39,22 +45,22 @@
39
45
  "@eslint-community/eslint-plugin-eslint-comments": "^4.7.1",
40
46
  "@stylistic/eslint-plugin": "^5.10.0",
41
47
  "@stylistic/stylelint-plugin": "^5.2.0",
42
- "@types/node": "^25.9.0",
43
- "@typescript-eslint/eslint-plugin": "^8.60.1",
44
- "@typescript-eslint/parser": "^8.60.1",
45
- "eslint-plugin-es-x": "^9.6.0",
48
+ "@types/node": "^25.9.3",
49
+ "@typescript-eslint/eslint-plugin": "^8.62.0",
50
+ "@typescript-eslint/parser": "^8.62.0",
51
+ "eslint-plugin-es-x": "^9.7.0",
46
52
  "eslint-plugin-jsdoc": "^62.9.0",
47
53
  "eslint-plugin-jsonc": "^3.1.2",
48
- "eslint-plugin-n": "^18.1.0",
54
+ "eslint-plugin-n": "^18.2.0",
49
55
  "eslint-plugin-promise": "^7.3.0",
50
56
  "eslint-plugin-regexp": "^3.1.0",
51
57
  "eslint-plugin-unicorn": "^65.0.1",
52
- "eslint-plugin-yml": "^3.3.2",
53
- "globals": "^17.6.0",
54
- "stylelint-plugin-use-baseline": "^1.4.2",
58
+ "eslint-plugin-yml": "^3.5.0",
59
+ "globals": "^17.7.0",
60
+ "stylelint-plugin-use-baseline": "^1.4.4",
55
61
  "stylelint-config-recommended": "^18.0.0"
56
62
  },
57
63
  "devDependencies": {
58
- "eslint": "^10.4.1"
64
+ "eslint": "^10.6.0"
59
65
  }
60
66
  }
@@ -1,6 +1,4 @@
1
- 'use strict';
2
-
3
- module.exports = {
1
+ export default {
4
2
  extends: 'stylelint-config-recommended',
5
3
  plugins: [
6
4
  'stylelint-plugin-use-baseline',