@so1ve/eslint-config 1.0.0-alpha.12 → 1.0.0-alpha.14

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/dist/index.cjs CHANGED
@@ -360,9 +360,7 @@ const html = () => [
360
360
  }
361
361
  ];
362
362
 
363
- const ignores = () => [
364
- { ignores: GLOB_EXCLUDE }
365
- ];
363
+ const ignores = () => [{ ignores: GLOB_EXCLUDE }];
366
364
 
367
365
  const imports = (options = {}) => [
368
366
  {
@@ -883,9 +881,7 @@ const sortImports = () => [
883
881
  }
884
882
  ];
885
883
 
886
- const test = ({
887
- overrides
888
- } = {}) => [
884
+ const test = ({ overrides } = {}) => [
889
885
  {
890
886
  plugins: {
891
887
  "no-only-tests": pluginNoOnlyTests__default["default"],
@@ -919,9 +915,7 @@ const test = ({
919
915
  }
920
916
  ];
921
917
 
922
- const toml = ({
923
- overrides
924
- } = {}) => [
918
+ const toml = ({ overrides } = {}) => [
925
919
  {
926
920
  plugins: {
927
921
  toml: pluginToml__default["default"]
@@ -1039,6 +1033,7 @@ function typescript({
1039
1033
  sourceType: "module",
1040
1034
  extraFileExtensions: componentExts.map((ext) => `.${ext}`),
1041
1035
  EXPERIMENTAL_useProjectService: true,
1036
+ // eslint-disable-next-line ts/no-unnecessary-type-assertion
1042
1037
  ...parserOptions
1043
1038
  }
1044
1039
  },
@@ -1131,7 +1126,15 @@ function typescript({
1131
1126
  "ts/prefer-ts-expect-error": "error",
1132
1127
  "ts/no-require-imports": "error",
1133
1128
  "ts/method-signature-style": ["error", "property"],
1134
- "ts/explicit-member-accessibility": "error",
1129
+ "ts/explicit-member-accessibility": [
1130
+ "error",
1131
+ {
1132
+ accessibility: "explicit",
1133
+ overrides: {
1134
+ constructors: "no-public"
1135
+ }
1136
+ }
1137
+ ],
1135
1138
  // Override JS
1136
1139
  "no-useless-constructor": "off",
1137
1140
  "no-invalid-this": "off",
@@ -1457,9 +1460,7 @@ const vue = ({
1457
1460
  }
1458
1461
  ];
1459
1462
 
1460
- const yaml = ({
1461
- overrides
1462
- } = {}) => [
1463
+ const yaml = ({ overrides } = {}) => [
1463
1464
  {
1464
1465
  plugins: {
1465
1466
  yaml: pluginYaml__default["default"]
package/dist/index.d.ts CHANGED
@@ -1,11 +1,12 @@
1
- import { FlatESLintConfigItem } from 'eslint-define-config';
1
+ import so1vePlugin from '@so1ve/eslint-plugin';
2
+ export { default as pluginSo1ve } from '@so1ve/eslint-plugin';
2
3
  import { ParserOptions } from '@typescript-eslint/parser';
3
4
  export { default as parserTs } from '@typescript-eslint/parser';
4
5
  import { FlatGitignoreOptions } from 'eslint-config-flat-gitignore';
6
+ import { Rules, FlatESLintConfigItem } from 'eslint-define-config';
5
7
  export { default as pluginComments } from '@eslint-community/eslint-plugin-eslint-comments';
6
8
  export { default as pluginHtml } from '@html-eslint/eslint-plugin';
7
9
  export { default as parserHtml } from '@html-eslint/parser';
8
- export { default as pluginSo1ve } from '@so1ve/eslint-plugin';
9
10
  export { default as pluginSortImports } from '@so1ve/eslint-plugin-sort-imports';
10
11
  export { default as pluginTs } from '@typescript-eslint/eslint-plugin';
11
12
  export { default as parserMdx } from 'eslint-mdx';
@@ -34,8 +35,6 @@ export { default as parserToml } from 'toml-eslint-parser';
34
35
  export { default as parserVue } from 'vue-eslint-parser';
35
36
  export { default as parserYaml } from 'yaml-eslint-parser';
36
37
 
37
- declare const comments: () => FlatESLintConfigItem[];
38
-
39
38
  interface OptionsComponentExts {
40
39
  /** Additional extensions for components. */
41
40
  componentExts?: string[];
@@ -48,7 +47,7 @@ interface OptionsHasTypeScript {
48
47
  typescript?: boolean;
49
48
  }
50
49
  interface OptionsOverrides {
51
- overrides?: FlatESLintConfigItem["rules"];
50
+ overrides?: ConfigItem["rules"];
52
51
  }
53
52
  interface Options extends OptionsComponentExts {
54
53
  /**
@@ -118,56 +117,73 @@ interface Options extends OptionsComponentExts {
118
117
  formatting?: boolean;
119
118
  /** Provide overrides for rules for each integration. */
120
119
  overrides?: {
121
- javascript?: FlatESLintConfigItem["rules"];
122
- typescript?: FlatESLintConfigItem["rules"];
123
- test?: FlatESLintConfigItem["rules"];
124
- vue?: FlatESLintConfigItem["rules"];
125
- solid?: FlatESLintConfigItem["rules"];
126
- jsonc?: FlatESLintConfigItem["rules"];
127
- mdx?: FlatESLintConfigItem["rules"];
128
- yaml?: FlatESLintConfigItem["rules"];
129
- toml?: FlatESLintConfigItem["rules"];
120
+ javascript?: ConfigItem["rules"];
121
+ typescript?: ConfigItem["rules"];
122
+ test?: ConfigItem["rules"];
123
+ vue?: ConfigItem["rules"];
124
+ solid?: ConfigItem["rules"];
125
+ jsonc?: ConfigItem["rules"];
126
+ mdx?: ConfigItem["rules"];
127
+ yaml?: ConfigItem["rules"];
128
+ toml?: ConfigItem["rules"];
130
129
  };
131
130
  }
131
+ type Unprefix<T extends Record<string, any>, Pre extends string> = {
132
+ [K in keyof T as K extends `${Pre}${infer U}` ? U : never]: T[K];
133
+ };
134
+ type Prefix<T extends Record<string, any>, Pre extends string> = {
135
+ [K in keyof T as `${Pre}${K & string}`]: T[K];
136
+ };
137
+ type RenamePrefix<T extends Record<string, any>, Old extends string, New extends string> = Prefix<Unprefix<T, Old>, New>;
138
+ type MergeIntersection<T extends Record<any, any>> = {
139
+ [K in keyof T]: T[K];
140
+ };
141
+ type RenamedRules = MergeIntersection<Rules & RenamePrefix<Rules, "@typescript-eslint/", "ts/"> & RenamePrefix<Rules, "yml/", "yaml/"> & RenamePrefix<Rules, "n/", "node/"> & Prefix<Partial<(typeof so1vePlugin)["rules"]>, "so1ve/">>;
142
+ type ConfigItem = Omit<FlatESLintConfigItem, "plugins" | "rules"> & {
143
+ plugins?: Record<string, any>;
144
+ rules?: RenamedRules | Record<string, any>;
145
+ };
146
+
147
+ declare const comments: () => ConfigItem[];
132
148
 
133
- declare const formatting: (options: Options) => FlatESLintConfigItem[];
149
+ declare const formatting: (options: Options) => ConfigItem[];
134
150
 
135
- declare const html: () => FlatESLintConfigItem[];
151
+ declare const html: () => ConfigItem[];
136
152
 
137
- declare const ignores: () => FlatESLintConfigItem[];
153
+ declare const ignores: () => ConfigItem[];
138
154
 
139
- declare const imports: (options?: Options) => FlatESLintConfigItem[];
155
+ declare const imports: (options?: Options) => ConfigItem[];
140
156
 
141
- declare const javascript: ({ overrides, }?: OptionsOverrides) => FlatESLintConfigItem[];
157
+ declare const javascript: ({ overrides, }?: OptionsOverrides) => ConfigItem[];
142
158
 
143
- declare const jsonc: () => FlatESLintConfigItem[];
159
+ declare const jsonc: () => ConfigItem[];
144
160
 
145
- declare const mdx: ({ componentExts, overrides, }?: OptionsComponentExts & OptionsOverrides) => FlatESLintConfigItem[];
161
+ declare const mdx: ({ componentExts, overrides, }?: OptionsComponentExts & OptionsOverrides) => ConfigItem[];
146
162
 
147
- declare const node: () => FlatESLintConfigItem[];
163
+ declare const node: () => ConfigItem[];
148
164
 
149
- declare const onlyError: () => FlatESLintConfigItem[];
165
+ declare const onlyError: () => ConfigItem[];
150
166
 
151
- declare const promise: () => FlatESLintConfigItem[];
167
+ declare const promise: () => ConfigItem[];
152
168
 
153
- declare const solid: ({ overrides, typescript, }?: OptionsHasTypeScript & OptionsOverrides) => FlatESLintConfigItem[];
169
+ declare const solid: ({ overrides, typescript, }?: OptionsHasTypeScript & OptionsOverrides) => ConfigItem[];
154
170
 
155
- declare const sortImports: () => FlatESLintConfigItem[];
171
+ declare const sortImports: () => ConfigItem[];
156
172
 
157
- declare const test: ({ overrides, }?: OptionsOverrides) => FlatESLintConfigItem[];
173
+ declare const test: ({ overrides }?: OptionsOverrides) => ConfigItem[];
158
174
 
159
- declare const toml: ({ overrides, }?: OptionsOverrides) => FlatESLintConfigItem[];
175
+ declare const toml: ({ overrides }?: OptionsOverrides) => ConfigItem[];
160
176
 
161
- declare function typescript({ componentExts, parserOptions, overrides, }?: OptionsTypeScriptParserOptions & OptionsComponentExts & OptionsOverrides): FlatESLintConfigItem[];
177
+ declare function typescript({ componentExts, parserOptions, overrides, }?: OptionsTypeScriptParserOptions & OptionsComponentExts & OptionsOverrides): ConfigItem[];
162
178
 
163
- declare const unicorn: () => FlatESLintConfigItem[];
179
+ declare const unicorn: () => ConfigItem[];
164
180
 
165
- declare const vue: ({ overrides, typescript, }?: OptionsHasTypeScript & OptionsOverrides) => FlatESLintConfigItem[];
181
+ declare const vue: ({ overrides, typescript, }?: OptionsHasTypeScript & OptionsOverrides) => ConfigItem[];
166
182
 
167
- declare const yaml: ({ overrides, }?: OptionsOverrides) => FlatESLintConfigItem[];
183
+ declare const yaml: ({ overrides }?: OptionsOverrides) => ConfigItem[];
168
184
 
169
185
  /** Construct an array of ESLint flat config items. */
170
- declare function so1ve(options?: Options, ...userConfigs: (FlatESLintConfigItem | FlatESLintConfigItem[])[]): FlatESLintConfigItem[];
186
+ declare function so1ve(options?: Options, ...userConfigs: (ConfigItem | ConfigItem[])[]): ConfigItem[];
171
187
 
172
188
  declare const GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
173
189
  declare const GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
@@ -197,12 +213,12 @@ declare const GLOB_ALL_SRC: string[];
197
213
  declare const GLOB_EXCLUDE: string[];
198
214
 
199
215
  /** Combine array and non-array configs into a single array. */
200
- declare const combine: (...configs: (FlatESLintConfigItem | FlatESLintConfigItem[])[]) => FlatESLintConfigItem[];
216
+ declare const combine: (...configs: (ConfigItem | ConfigItem[])[]) => ConfigItem[];
201
217
  declare const renameRules: (rules: Record<string, any>, from: string, to: string) => {
202
218
  [k: string]: any;
203
219
  };
204
- declare function recordRulesStateConfigs(configs: FlatESLintConfigItem[]): FlatESLintConfigItem[];
205
- declare function recordRulesState(rules: FlatESLintConfigItem["rules"]): FlatESLintConfigItem["rules"];
220
+ declare function recordRulesStateConfigs(configs: ConfigItem[]): ConfigItem[];
221
+ declare function recordRulesState(rules: ConfigItem["rules"]): ConfigItem["rules"];
206
222
  declare function warnUnnecessaryOffRules(): void;
207
223
 
208
- export { GLOB_ALL_SRC, GLOB_CSS, GLOB_DTS, GLOB_ESLINTRC, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_PACKAGEJSON, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSCONFIG, GLOB_TSX, GLOB_VUE, GLOB_YAML, Options, OptionsComponentExts, OptionsHasTypeScript, OptionsOverrides, OptionsTypeScriptParserOptions, combine, comments, formatting, html, ignores, imports, javascript, jsonc, mdx, node, onlyError, promise, recordRulesState, recordRulesStateConfigs, renameRules, so1ve, solid, sortImports, test, toml, typescript, unicorn, vue, warnUnnecessaryOffRules, yaml };
224
+ export { ConfigItem, GLOB_ALL_SRC, GLOB_CSS, GLOB_DTS, GLOB_ESLINTRC, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_PACKAGEJSON, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSCONFIG, GLOB_TSX, GLOB_VUE, GLOB_YAML, Options, OptionsComponentExts, OptionsHasTypeScript, OptionsOverrides, OptionsTypeScriptParserOptions, RenamedRules, combine, comments, formatting, html, ignores, imports, javascript, jsonc, mdx, node, onlyError, promise, recordRulesState, recordRulesStateConfigs, renameRules, so1ve, solid, sortImports, test, toml, typescript, unicorn, vue, warnUnnecessaryOffRules, yaml };
package/dist/index.mjs CHANGED
@@ -349,9 +349,7 @@ const html = () => [
349
349
  }
350
350
  ];
351
351
 
352
- const ignores = () => [
353
- { ignores: GLOB_EXCLUDE }
354
- ];
352
+ const ignores = () => [{ ignores: GLOB_EXCLUDE }];
355
353
 
356
354
  const imports = (options = {}) => [
357
355
  {
@@ -872,9 +870,7 @@ const sortImports = () => [
872
870
  }
873
871
  ];
874
872
 
875
- const test = ({
876
- overrides
877
- } = {}) => [
873
+ const test = ({ overrides } = {}) => [
878
874
  {
879
875
  plugins: {
880
876
  "no-only-tests": pluginNoOnlyTests,
@@ -908,9 +904,7 @@ const test = ({
908
904
  }
909
905
  ];
910
906
 
911
- const toml = ({
912
- overrides
913
- } = {}) => [
907
+ const toml = ({ overrides } = {}) => [
914
908
  {
915
909
  plugins: {
916
910
  toml: pluginToml
@@ -1028,6 +1022,7 @@ function typescript({
1028
1022
  sourceType: "module",
1029
1023
  extraFileExtensions: componentExts.map((ext) => `.${ext}`),
1030
1024
  EXPERIMENTAL_useProjectService: true,
1025
+ // eslint-disable-next-line ts/no-unnecessary-type-assertion
1031
1026
  ...parserOptions
1032
1027
  }
1033
1028
  },
@@ -1120,7 +1115,15 @@ function typescript({
1120
1115
  "ts/prefer-ts-expect-error": "error",
1121
1116
  "ts/no-require-imports": "error",
1122
1117
  "ts/method-signature-style": ["error", "property"],
1123
- "ts/explicit-member-accessibility": "error",
1118
+ "ts/explicit-member-accessibility": [
1119
+ "error",
1120
+ {
1121
+ accessibility: "explicit",
1122
+ overrides: {
1123
+ constructors: "no-public"
1124
+ }
1125
+ }
1126
+ ],
1124
1127
  // Override JS
1125
1128
  "no-useless-constructor": "off",
1126
1129
  "no-invalid-this": "off",
@@ -1446,9 +1449,7 @@ const vue = ({
1446
1449
  }
1447
1450
  ];
1448
1451
 
1449
- const yaml = ({
1450
- overrides
1451
- } = {}) => [
1452
+ const yaml = ({ overrides } = {}) => [
1452
1453
  {
1453
1454
  plugins: {
1454
1455
  yaml: pluginYaml
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@so1ve/eslint-config",
3
- "version": "1.0.0-alpha.12",
3
+ "version": "1.0.0-alpha.14",
4
4
  "author": "Ray <i@mk1.io> (https://github.com/so1ve/)",
5
5
  "description": "Ray's eslint config.",
6
6
  "keywords": [
@@ -70,8 +70,8 @@
70
70
  "toml-eslint-parser": "^0.6.0",
71
71
  "vue-eslint-parser": "^9.3.1",
72
72
  "yaml-eslint-parser": "^1.2.2",
73
- "@so1ve/eslint-plugin": "1.0.0-alpha.12",
74
- "@so1ve/eslint-plugin-sort-imports": "1.0.0-alpha.12"
73
+ "@so1ve/eslint-plugin": "1.0.0-alpha.14",
74
+ "@so1ve/eslint-plugin-sort-imports": "1.0.0-alpha.14"
75
75
  },
76
76
  "devDependencies": {
77
77
  "eslint": "^8.46.0"