@mouse_484/eslint-config 2.0.16 → 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.
package/package.json CHANGED
@@ -1,20 +1,25 @@
1
1
  {
2
2
  "name": "@mouse_484/eslint-config",
3
- "version": "2.0.16",
4
- "description": "mouse484/config",
5
- "main": "index.js",
3
+ "type": "module",
4
+ "version": "3.1.0",
5
+ "author": "mouse_484",
6
6
  "license": "MIT",
7
- "publishConfig": {
8
- "access": "public"
7
+ "homepage": "https://github.com/mouse484/config/tree/main/packages/eslint",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/mouse484/config.git"
9
11
  },
10
- "devDependencies": {
11
- "eslint": "^8.56.0"
12
+ "bugs": {
13
+ "url": "https://github.com/mouse484/config/issues"
12
14
  },
15
+ "keywords": [
16
+ "eslint-config"
17
+ ],
18
+ "main": "src/index.js",
13
19
  "dependencies": {
14
- "@mouse_484/eslint-config-base": "2.0.2",
15
- "@mouse_484/eslint-config-import": "2.0.3",
16
- "@mouse_484/eslint-config-prettier": "2.0.3",
17
- "@mouse_484/eslint-config-typescript": "2.0.14",
18
- "eslint-plugin-import": "^2.29.1"
20
+ "@antfu/eslint-config": "^2.21.1"
21
+ },
22
+ "devDependencies": {
23
+ "@typescript-eslint/eslint-plugin": "^7.13.1"
19
24
  }
20
25
  }
package/src/index.js ADDED
@@ -0,0 +1,78 @@
1
+ // @ts-check
2
+ import antfu, {
3
+ GLOB_SRC,
4
+ GLOB_TS,
5
+ GLOB_TSX,
6
+ interopDefault,
7
+ renameRules,
8
+ resolveSubOptions,
9
+ } from '@antfu/eslint-config'
10
+
11
+ /**
12
+ * @typedef {import('@antfu/eslint-config').OptionsConfig} OptionsConfig
13
+ * @typedef {import('@antfu/eslint-config').TypedFlatConfigItem} TypedFlatConfigItem
14
+ */
15
+
16
+ /**
17
+ * Construct an array of ESLint flat config items.
18
+ * ref: https://github.com/antfu/eslint-config/blob/main/src/factory.ts
19
+ *
20
+ * @param {OptionsConfig & TypedFlatConfigItem} options
21
+ * The options for generating the ESLint configurations.
22
+ * @param {import('@antfu/eslint-config').Awaitable<TypedFlatConfigItem | TypedFlatConfigItem[]>[]} userConfigs
23
+ * The user configurations to be merged with the generated configurations.
24
+ * @returns {Promise<TypedFlatConfigItem[]>}
25
+ * The merged ESLint configurations.
26
+ */
27
+ export async function mouse(options, ...userConfigs) {
28
+ /** @type {TypedFlatConfigItem[]} */
29
+ const configs = []
30
+
31
+ configs.push({
32
+ name: 'mouse/source-files',
33
+ files: [GLOB_SRC],
34
+ rules: {
35
+ 'style/max-len': ['error', {
36
+ code: 80,
37
+ tabWidth: 2,
38
+ comments: 120,
39
+ }],
40
+ },
41
+ })
42
+
43
+ if (options?.typescript) {
44
+ const pluginTs = await interopDefault(
45
+ import('@typescript-eslint/eslint-plugin'),
46
+ )
47
+
48
+ /**
49
+ * @param {string} key
50
+ * @returns {import("eslint").Linter.RulesRecord}
51
+ * if tsconfigPath is defined, append '-type-checked' to the key
52
+ */
53
+ const getRules = (key) => {
54
+ const typescriptOptions = resolveSubOptions(options, 'typescript')
55
+ const tsconfigPath = 'tsconfigPath' in typescriptOptions
56
+ ? typescriptOptions.tsconfigPath
57
+ : undefined
58
+
59
+ return renameRules(
60
+ pluginTs.configs[
61
+ tsconfigPath ? `${key}-type-checked` : key
62
+ ]?.rules ?? {},
63
+ { '@typescript-eslint': 'ts' },
64
+ )
65
+ }
66
+
67
+ configs.push({
68
+ name: 'mouse/typescript',
69
+ files: [GLOB_TS, GLOB_TSX],
70
+ rules: {
71
+ ...getRules('strict'),
72
+ ...getRules('stylistic'),
73
+ },
74
+ })
75
+ }
76
+
77
+ return antfu(options, ...configs, ...userConfigs)
78
+ }
package/.eslintrc.yml DELETED
@@ -1,6 +0,0 @@
1
- extends: '@mouse_484/eslint-config-base'
2
- env:
3
- es2022: true
4
- rules:
5
- no-var: error
6
- prefer-const: error
package/CHANGELOG.md DELETED
@@ -1,80 +0,0 @@
1
- ### Dependencies
2
-
3
- * **@mouse_484/eslint-config-typescript:** upgraded to 2.0.14
4
-
5
- ### Dependencies
6
-
7
- * **@mouse_484/eslint-config-typescript:** upgraded to 2.0.13
8
-
9
- ### Dependencies
10
-
11
- * **@mouse_484/eslint-config-typescript:** upgraded to 2.0.12
12
-
13
- ### Dependencies
14
-
15
- * **@mouse_484/eslint-config-typescript:** upgraded to 2.0.11
16
-
17
- ### Dependencies
18
-
19
- * **@mouse_484/eslint-config-typescript:** upgraded to 2.0.10
20
-
21
- ### Dependencies
22
-
23
- * **@mouse_484/eslint-config-typescript:** upgraded to 2.0.9
24
-
25
- ### Dependencies
26
-
27
- * **@mouse_484/eslint-config-typescript:** upgraded to 2.0.8
28
-
29
- ### Dependencies
30
-
31
- * **@mouse_484/eslint-config-typescript:** upgraded to 2.0.7
32
-
33
- ### Dependencies
34
-
35
- * **@mouse_484/eslint-config-typescript:** upgraded to 2.0.6
36
-
37
- ### Dependencies
38
-
39
- * **@mouse_484/eslint-config-import:** upgraded to 2.0.3
40
-
41
- ### Dependencies
42
-
43
- * **@mouse_484/eslint-config-typescript:** upgraded to 2.0.5
44
-
45
- ### Dependencies
46
-
47
- * **@mouse_484/eslint-config-typescript:** upgraded to 2.0.4
48
-
49
- ### Dependencies
50
-
51
- * **@mouse_484/eslint-config-prettier:** upgraded to 2.0.3
52
-
53
- ### Dependencies
54
-
55
- * **@mouse_484/eslint-config-typescript:** upgraded to 2.0.3
56
-
57
- ### Dependencies
58
-
59
- * **@mouse_484/eslint-config-typescript:** upgraded to 2.0.2
60
-
61
- ### Dependencies
62
-
63
- * **@mouse_484/eslint-config-base:** upgraded to 2.0.1
64
- * **@mouse_484/eslint-config-import:** upgraded to 2.0.1
65
- * **@mouse_484/eslint-config-prettier:** upgraded to 2.0.1
66
- * **@mouse_484/eslint-config-typescript:** upgraded to 2.0.1
67
-
68
- ### Dependencies
69
-
70
- * **@mouse_484/eslint-config-base:** upgraded to 2.0.0
71
- * **@mouse_484/eslint-config-import:** upgraded to 2.0.0
72
- * **@mouse_484/eslint-config-prettier:** upgraded to 2.0.0
73
- * **@mouse_484/eslint-config-typescript:** upgraded to 2.0.0
74
-
75
- ### Dependencies
76
-
77
- - **@mouse_484/eslint-config-base:** upgraded to 1.0.0
78
- - **@mouse_484/eslint-config-import:** upgraded to 1.0.0
79
- - **@mouse_484/eslint-config-prettier:** upgraded to 1.0.0
80
- - **@mouse_484/eslint-config-typescript:** upgraded to 1.0.0
package/index.js DELETED
@@ -1,16 +0,0 @@
1
- /* eslint-disable no-undef */
2
- /** @type {import('eslint/lib/shared/types').ConfigData} */
3
- module.exports = {
4
- extends: [
5
- './.eslintrc.yml',
6
- // '@mouse_484/eslint-config-typescript',
7
- // '@mouse_484/eslint-config-import',
8
- // 'plugin:import/typescript',
9
- // '@mouse_484/eslint-config-prettier',
10
- ],
11
- // settings: { 'import/resolver': { typescript: true, node: true } },
12
- env: {
13
- // browser: true,w
14
- // node: true,
15
- },
16
- };