@bhsd/code-standard 2.7.0 → 3.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.
@@ -1167,10 +1167,11 @@ export const extend = (...args) => {
1167
1167
  if (args.some(arg => Array.isArray(arg))) {
1168
1168
  throw new TypeError('只支持传入单个配置对象,禁止传入配置数组!');
1169
1169
  }
1170
- const moreIgnores = args.filter(({files: f, ignores: i}) => !f && i),
1170
+ const isModule = Number(args.includes('module')),
1171
+ moreIgnores = args.filter(({files: f, ignores: i}) => !f && i),
1171
1172
  moreGeneral = args.filter(({files: f, rules, plugins}) => !f && (rules || plugins)),
1172
1173
  moreFiles = args.filter(({files: f}) => f);
1173
- if (moreIgnores.length + moreGeneral.length + moreFiles.length !== args.length) {
1174
+ if (isModule + moreIgnores.length + moreGeneral.length + moreFiles.length !== args.length) {
1174
1175
  throw new RangeError('传入的配置项只能是忽略项、通用规则项或文件规则项三种之一!');
1175
1176
  }
1176
1177
  return [
@@ -1181,6 +1182,16 @@ export const extend = (...args) => {
1181
1182
  ...json,
1182
1183
  ...yaml,
1183
1184
  ...ts,
1185
+ ...isModule
1186
+ ? [
1187
+ {
1188
+ files: ['**/*.js'],
1189
+ languageOptions: {
1190
+ sourceType: 'module',
1191
+ },
1192
+ },
1193
+ ]
1194
+ : [],
1184
1195
  ...moreFiles,
1185
1196
  ];
1186
1197
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bhsd/code-standard",
3
- "version": "2.7.0",
3
+ "version": "3.0.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,9 +45,9 @@
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",
48
+ "@types/node": "^25.9.3",
49
+ "@typescript-eslint/eslint-plugin": "^8.61.0",
50
+ "@typescript-eslint/parser": "^8.61.0",
45
51
  "eslint-plugin-es-x": "^9.6.0",
46
52
  "eslint-plugin-jsdoc": "^62.9.0",
47
53
  "eslint-plugin-jsonc": "^3.1.2",
@@ -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',