@rebeccastevens/eslint-config 3.0.4 → 3.0.6

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
@@ -431,23 +431,23 @@ async function formatters(opts, stylistic) {
431
431
  "style/ts/space-before-function-paren": "off",
432
432
  "style/ts/space-infix-ops": "off",
433
433
  "style/ts/type-annotation-spacing": "off",
434
- "@typescript-eslint/block-spacing": "off",
435
- "@typescript-eslint/brace-style": "off",
436
- "@typescript-eslint/comma-dangle": "off",
437
- "@typescript-eslint/comma-spacing": "off",
438
- "@typescript-eslint/func-call-spacing": "off",
439
- "@typescript-eslint/indent": "off",
440
- "@typescript-eslint/key-spacing": "off",
441
- "@typescript-eslint/keyword-spacing": "off",
442
- "@typescript-eslint/member-delimiter-style": "off",
443
- "@typescript-eslint/no-extra-parens": "off",
444
- "@typescript-eslint/no-extra-semi": "off",
445
- "@typescript-eslint/object-curly-spacing": "off",
446
- "@typescript-eslint/semi": "off",
447
- "@typescript-eslint/space-before-blocks": "off",
448
- "@typescript-eslint/space-before-function-paren": "off",
449
- "@typescript-eslint/space-infix-ops": "off",
450
- "@typescript-eslint/type-annotation-spacing": "off",
434
+ "ts/block-spacing": "off",
435
+ "ts/brace-style": "off",
436
+ "ts/comma-dangle": "off",
437
+ "ts/comma-spacing": "off",
438
+ "ts/func-call-spacing": "off",
439
+ "ts/indent": "off",
440
+ "ts/key-spacing": "off",
441
+ "ts/keyword-spacing": "off",
442
+ "ts/member-delimiter-style": "off",
443
+ "ts/no-extra-parens": "off",
444
+ "ts/no-extra-semi": "off",
445
+ "ts/object-curly-spacing": "off",
446
+ "ts/semi": "off",
447
+ "ts/space-before-blocks": "off",
448
+ "ts/space-before-function-paren": "off",
449
+ "ts/space-infix-ops": "off",
450
+ "ts/type-annotation-spacing": "off",
451
451
  "unicorn/empty-brace-spaces": "off",
452
452
  "unicorn/no-nested-ternary": "off",
453
453
  "unicorn/number-literal-case": "off",
@@ -1046,12 +1046,13 @@ async function ignores(options) {
1046
1046
  }
1047
1047
 
1048
1048
  async function imports(options) {
1049
- const { stylistic, parserOptions } = options;
1050
- const [pluginImport] = (await loadPackages([
1051
- "eslint-plugin-import-x",
1052
- "eslint-import-resolver-typescript",
1053
- ]));
1054
- const stylisticEnforcement = stylistic === false ? "off" : "error";
1049
+ const { stylistic, parserOptions, typescript } = options;
1050
+ const [pluginImport] = (await loadPackages(typescript
1051
+ ? [
1052
+ "eslint-plugin-import-x",
1053
+ "eslint-import-resolver-typescript", // make sure it exists - we only implicitly use it
1054
+ ]
1055
+ : ["eslint-plugin-import-x"]));
1055
1056
  return [
1056
1057
  {
1057
1058
  name: "rs:imports",
@@ -1066,16 +1067,24 @@ async function imports(options) {
1066
1067
  "import-x/internal-regex": "^(?:#|(?:@|~)\\/).*",
1067
1068
  "import-x/extensions": [".ts", ".tsx", ".js", ".jsx"],
1068
1069
  "import-x/parsers": {
1069
- "@typescript-eslint/parser": [".ts", ".tsx", ".cts", ".mts"],
1070
+ ...(typescript
1071
+ ? {
1072
+ "@typescript-eslint/parser": [".ts", ".tsx", ".cts", ".mts"],
1073
+ }
1074
+ : undefined),
1070
1075
  },
1071
1076
  "import-x/resolver": {
1072
- typescript: {
1073
- alwaysTryTypes: true,
1074
- projectService: parserOptions.projectService,
1075
- },
1076
1077
  node: {
1077
1078
  extensions: [".ts", ".tsx", ".js", ".jsx"],
1078
1079
  },
1080
+ ...(typescript
1081
+ ? {
1082
+ typescript: {
1083
+ alwaysTryTypes: true,
1084
+ projectService: parserOptions.projectService,
1085
+ },
1086
+ }
1087
+ : undefined),
1079
1088
  },
1080
1089
  },
1081
1090
  rules: {
@@ -1168,9 +1177,12 @@ async function imports(options) {
1168
1177
  "import/no-webpack-loader-syntax": "error",
1169
1178
  // "import/prefer-default-export": "off",
1170
1179
  // "import/unambiguous": "off",
1171
- "import/newline-after-import": [stylisticEnforcement, { count: 1 }],
1180
+ "import/newline-after-import": [
1181
+ stylistic === false ? "off" : "error",
1182
+ { count: 1 },
1183
+ ],
1172
1184
  "import/order": [
1173
- stylisticEnforcement,
1185
+ stylistic === false ? "off" : "error",
1174
1186
  {
1175
1187
  alphabetize: {
1176
1188
  caseInsensitive: false,
@@ -1196,24 +1208,28 @@ async function imports(options) {
1196
1208
  "import/no-dynamic-require": "error",
1197
1209
  },
1198
1210
  },
1199
- {
1200
- files: [GLOB_TS, GLOB_TSX, GLOB_DTS],
1201
- rules: {
1202
- "import/no-unresolved": "off",
1203
- "import/named": "off",
1204
- "import/default": "off",
1205
- "import/namespace": "off",
1206
- "ts/no-import-type-side-effects": "error",
1207
- "ts/consistent-type-imports": [
1208
- stylisticEnforcement,
1209
- {
1210
- prefer: "type-imports",
1211
- fixStyle: "inline-type-imports",
1212
- disallowTypeAnnotations: false,
1211
+ ...((typescript
1212
+ ? [
1213
+ {
1214
+ files: [GLOB_TS, GLOB_TSX, GLOB_DTS],
1215
+ rules: {
1216
+ "import/no-unresolved": "off",
1217
+ "import/named": "off",
1218
+ "import/default": "off",
1219
+ "import/namespace": "off",
1220
+ "ts/no-import-type-side-effects": "error",
1221
+ "ts/consistent-type-imports": [
1222
+ stylistic === false ? "off" : "error",
1223
+ {
1224
+ prefer: "type-imports",
1225
+ fixStyle: "inline-type-imports",
1226
+ disallowTypeAnnotations: false,
1227
+ },
1228
+ ],
1213
1229
  },
1214
- ],
1215
- },
1216
- },
1230
+ },
1231
+ ]
1232
+ : [])),
1217
1233
  ];
1218
1234
  }
1219
1235
 
@@ -3606,6 +3622,7 @@ async function rsEslint(options, ...userConfigs) {
3606
3622
  }), imports({
3607
3623
  ...typescriptConfigOptions,
3608
3624
  stylistic: stylisticOptions,
3625
+ typescript: hasTypeScript,
3609
3626
  }), jsdoc({
3610
3627
  stylistic: stylisticOptions,
3611
3628
  }), promise(), regexp(), sonar(functionalConfigOptions), comments(), unicorn(), node());
@@ -3708,7 +3725,7 @@ async function rsEslint(options, ...userConfigs) {
3708
3725
  if (autoRenamePlugins) {
3709
3726
  m_composer = m_composer.renamePlugins(defaultPluginRenaming);
3710
3727
  }
3711
- return m_composer;
3728
+ return m_composer.toConfigs();
3712
3729
  }
3713
3730
  function resolveSubOptions(options, key) {
3714
3731
  return (typeof options[key] === "boolean" || typeof options[key] === "string"
package/dist/index.d.cts CHANGED
@@ -7,7 +7,6 @@ import { ESLint, Linter } from "eslint";
7
7
  import { Options as VueBlocksOptions } from "eslint-processor-vue-blocks";
8
8
  import { Options as PrettierOptions } from "prettier";
9
9
  import { SettingsVueI18nLocaleDir } from "../typings/eslint-plugin-vue-i18n";
10
- import { FlatConfigComposer } from "eslint-flat-config-utils";
11
10
  declare module "eslint" {
12
11
  namespace Linter {
13
12
  interface RulesRecord extends RuleOptions {
@@ -13659,7 +13658,7 @@ declare function functional(options: Readonly<Required<OptionsFunctional & Requi
13659
13658
  declare function ignores(options: Readonly<{
13660
13659
  ignores: OptionsIgnores;
13661
13660
  } & OptionsProjectRoot & OptionsIgnoreFiles>): Promise<FlatConfigItem[]>;
13662
- declare function imports(options: Readonly<Required<RequiredOptionsStylistic & OptionsTypeScriptParserOptions>>): Promise<FlatConfigItem[]>;
13661
+ declare function imports(options: Readonly<Required<RequiredOptionsStylistic & OptionsTypeScriptParserOptions & OptionsHasTypeScript>>): Promise<FlatConfigItem[]>;
13663
13662
  declare function inEditor(): FlatConfigItem[];
13664
13663
  declare function javascript(options: Readonly<Required<OptionsOverrides & OptionsFunctional>>): FlatConfigItem[];
13665
13664
  declare function jsdoc(options: Readonly<Required<RequiredOptionsStylistic>>): Promise<FlatConfigItem[]>;
@@ -13707,7 +13706,7 @@ declare const defaultPluginRenaming: {
13707
13706
  * @param {Awaitable<FlatConfigItem | FlatConfigItem[]>[]} userConfigs - The user configurations to be merged with the generated configurations.
13708
13707
  * @returns {Promise<FlatConfigItem[]>} The merged ESLint configurations.
13709
13708
  */
13710
- declare function rsEslint(options: OptionsConfig, ...userConfigs: ReadonlyArray<Awaitable<FlatConfigItem | FlatConfigItem[]>>): Promise<FlatConfigComposer<FlatConfigItem>>;
13709
+ declare function rsEslint(options: OptionsConfig, ...userConfigs: ReadonlyArray<Awaitable<FlatConfigItem | FlatConfigItem[]>>): Promise<FlatConfigItem[]>;
13711
13710
  type ResolvedOptions<T> = T extends boolean ? never : T extends string ? never : NonNullable<T>;
13712
13711
  declare function resolveSubOptions<K extends keyof OptionsConfig>(options: Readonly<OptionsConfig>, key: K): ResolvedOptions<OptionsConfig[K]>;
13713
13712
  declare function getOverrides<K extends keyof OptionsConfig>(options: Readonly<OptionsConfig>, key: K): (Partial<Record<string, import("@typescript-eslint/utils/ts-eslint").SharedConfig.RuleEntry>> & RuleOptions) | undefined;
package/dist/index.d.mts CHANGED
@@ -7,7 +7,6 @@ import { ESLint, Linter } from "eslint";
7
7
  import { Options as VueBlocksOptions } from "eslint-processor-vue-blocks";
8
8
  import { Options as PrettierOptions } from "prettier";
9
9
  import { SettingsVueI18nLocaleDir } from "../typings/eslint-plugin-vue-i18n";
10
- import { FlatConfigComposer } from "eslint-flat-config-utils";
11
10
  declare module "eslint" {
12
11
  namespace Linter {
13
12
  interface RulesRecord extends RuleOptions {
@@ -13659,7 +13658,7 @@ declare function functional(options: Readonly<Required<OptionsFunctional & Requi
13659
13658
  declare function ignores(options: Readonly<{
13660
13659
  ignores: OptionsIgnores;
13661
13660
  } & OptionsProjectRoot & OptionsIgnoreFiles>): Promise<FlatConfigItem[]>;
13662
- declare function imports(options: Readonly<Required<RequiredOptionsStylistic & OptionsTypeScriptParserOptions>>): Promise<FlatConfigItem[]>;
13661
+ declare function imports(options: Readonly<Required<RequiredOptionsStylistic & OptionsTypeScriptParserOptions & OptionsHasTypeScript>>): Promise<FlatConfigItem[]>;
13663
13662
  declare function inEditor(): FlatConfigItem[];
13664
13663
  declare function javascript(options: Readonly<Required<OptionsOverrides & OptionsFunctional>>): FlatConfigItem[];
13665
13664
  declare function jsdoc(options: Readonly<Required<RequiredOptionsStylistic>>): Promise<FlatConfigItem[]>;
@@ -13707,7 +13706,7 @@ declare const defaultPluginRenaming: {
13707
13706
  * @param {Awaitable<FlatConfigItem | FlatConfigItem[]>[]} userConfigs - The user configurations to be merged with the generated configurations.
13708
13707
  * @returns {Promise<FlatConfigItem[]>} The merged ESLint configurations.
13709
13708
  */
13710
- declare function rsEslint(options: OptionsConfig, ...userConfigs: ReadonlyArray<Awaitable<FlatConfigItem | FlatConfigItem[]>>): Promise<FlatConfigComposer<FlatConfigItem>>;
13709
+ declare function rsEslint(options: OptionsConfig, ...userConfigs: ReadonlyArray<Awaitable<FlatConfigItem | FlatConfigItem[]>>): Promise<FlatConfigItem[]>;
13711
13710
  type ResolvedOptions<T> = T extends boolean ? never : T extends string ? never : NonNullable<T>;
13712
13711
  declare function resolveSubOptions<K extends keyof OptionsConfig>(options: Readonly<OptionsConfig>, key: K): ResolvedOptions<OptionsConfig[K]>;
13713
13712
  declare function getOverrides<K extends keyof OptionsConfig>(options: Readonly<OptionsConfig>, key: K): (Partial<Record<string, import("@typescript-eslint/utils/ts-eslint").SharedConfig.RuleEntry>> & RuleOptions) | undefined;
package/dist/index.mjs CHANGED
@@ -409,23 +409,23 @@ async function formatters(opts, stylistic) {
409
409
  "style/ts/space-before-function-paren": "off",
410
410
  "style/ts/space-infix-ops": "off",
411
411
  "style/ts/type-annotation-spacing": "off",
412
- "@typescript-eslint/block-spacing": "off",
413
- "@typescript-eslint/brace-style": "off",
414
- "@typescript-eslint/comma-dangle": "off",
415
- "@typescript-eslint/comma-spacing": "off",
416
- "@typescript-eslint/func-call-spacing": "off",
417
- "@typescript-eslint/indent": "off",
418
- "@typescript-eslint/key-spacing": "off",
419
- "@typescript-eslint/keyword-spacing": "off",
420
- "@typescript-eslint/member-delimiter-style": "off",
421
- "@typescript-eslint/no-extra-parens": "off",
422
- "@typescript-eslint/no-extra-semi": "off",
423
- "@typescript-eslint/object-curly-spacing": "off",
424
- "@typescript-eslint/semi": "off",
425
- "@typescript-eslint/space-before-blocks": "off",
426
- "@typescript-eslint/space-before-function-paren": "off",
427
- "@typescript-eslint/space-infix-ops": "off",
428
- "@typescript-eslint/type-annotation-spacing": "off",
412
+ "ts/block-spacing": "off",
413
+ "ts/brace-style": "off",
414
+ "ts/comma-dangle": "off",
415
+ "ts/comma-spacing": "off",
416
+ "ts/func-call-spacing": "off",
417
+ "ts/indent": "off",
418
+ "ts/key-spacing": "off",
419
+ "ts/keyword-spacing": "off",
420
+ "ts/member-delimiter-style": "off",
421
+ "ts/no-extra-parens": "off",
422
+ "ts/no-extra-semi": "off",
423
+ "ts/object-curly-spacing": "off",
424
+ "ts/semi": "off",
425
+ "ts/space-before-blocks": "off",
426
+ "ts/space-before-function-paren": "off",
427
+ "ts/space-infix-ops": "off",
428
+ "ts/type-annotation-spacing": "off",
429
429
  "unicorn/empty-brace-spaces": "off",
430
430
  "unicorn/no-nested-ternary": "off",
431
431
  "unicorn/number-literal-case": "off",
@@ -1024,12 +1024,13 @@ async function ignores(options) {
1024
1024
  }
1025
1025
 
1026
1026
  async function imports(options) {
1027
- const { stylistic, parserOptions } = options;
1028
- const [pluginImport] = (await loadPackages([
1029
- "eslint-plugin-import-x",
1030
- "eslint-import-resolver-typescript",
1031
- ]));
1032
- const stylisticEnforcement = stylistic === false ? "off" : "error";
1027
+ const { stylistic, parserOptions, typescript } = options;
1028
+ const [pluginImport] = (await loadPackages(typescript
1029
+ ? [
1030
+ "eslint-plugin-import-x",
1031
+ "eslint-import-resolver-typescript", // make sure it exists - we only implicitly use it
1032
+ ]
1033
+ : ["eslint-plugin-import-x"]));
1033
1034
  return [
1034
1035
  {
1035
1036
  name: "rs:imports",
@@ -1044,16 +1045,24 @@ async function imports(options) {
1044
1045
  "import-x/internal-regex": "^(?:#|(?:@|~)\\/).*",
1045
1046
  "import-x/extensions": [".ts", ".tsx", ".js", ".jsx"],
1046
1047
  "import-x/parsers": {
1047
- "@typescript-eslint/parser": [".ts", ".tsx", ".cts", ".mts"],
1048
+ ...(typescript
1049
+ ? {
1050
+ "@typescript-eslint/parser": [".ts", ".tsx", ".cts", ".mts"],
1051
+ }
1052
+ : undefined),
1048
1053
  },
1049
1054
  "import-x/resolver": {
1050
- typescript: {
1051
- alwaysTryTypes: true,
1052
- projectService: parserOptions.projectService,
1053
- },
1054
1055
  node: {
1055
1056
  extensions: [".ts", ".tsx", ".js", ".jsx"],
1056
1057
  },
1058
+ ...(typescript
1059
+ ? {
1060
+ typescript: {
1061
+ alwaysTryTypes: true,
1062
+ projectService: parserOptions.projectService,
1063
+ },
1064
+ }
1065
+ : undefined),
1057
1066
  },
1058
1067
  },
1059
1068
  rules: {
@@ -1146,9 +1155,12 @@ async function imports(options) {
1146
1155
  "import/no-webpack-loader-syntax": "error",
1147
1156
  // "import/prefer-default-export": "off",
1148
1157
  // "import/unambiguous": "off",
1149
- "import/newline-after-import": [stylisticEnforcement, { count: 1 }],
1158
+ "import/newline-after-import": [
1159
+ stylistic === false ? "off" : "error",
1160
+ { count: 1 },
1161
+ ],
1150
1162
  "import/order": [
1151
- stylisticEnforcement,
1163
+ stylistic === false ? "off" : "error",
1152
1164
  {
1153
1165
  alphabetize: {
1154
1166
  caseInsensitive: false,
@@ -1174,24 +1186,28 @@ async function imports(options) {
1174
1186
  "import/no-dynamic-require": "error",
1175
1187
  },
1176
1188
  },
1177
- {
1178
- files: [GLOB_TS, GLOB_TSX, GLOB_DTS],
1179
- rules: {
1180
- "import/no-unresolved": "off",
1181
- "import/named": "off",
1182
- "import/default": "off",
1183
- "import/namespace": "off",
1184
- "ts/no-import-type-side-effects": "error",
1185
- "ts/consistent-type-imports": [
1186
- stylisticEnforcement,
1187
- {
1188
- prefer: "type-imports",
1189
- fixStyle: "inline-type-imports",
1190
- disallowTypeAnnotations: false,
1189
+ ...((typescript
1190
+ ? [
1191
+ {
1192
+ files: [GLOB_TS, GLOB_TSX, GLOB_DTS],
1193
+ rules: {
1194
+ "import/no-unresolved": "off",
1195
+ "import/named": "off",
1196
+ "import/default": "off",
1197
+ "import/namespace": "off",
1198
+ "ts/no-import-type-side-effects": "error",
1199
+ "ts/consistent-type-imports": [
1200
+ stylistic === false ? "off" : "error",
1201
+ {
1202
+ prefer: "type-imports",
1203
+ fixStyle: "inline-type-imports",
1204
+ disallowTypeAnnotations: false,
1205
+ },
1206
+ ],
1191
1207
  },
1192
- ],
1193
- },
1194
- },
1208
+ },
1209
+ ]
1210
+ : [])),
1195
1211
  ];
1196
1212
  }
1197
1213
 
@@ -3584,6 +3600,7 @@ async function rsEslint(options, ...userConfigs) {
3584
3600
  }), imports({
3585
3601
  ...typescriptConfigOptions,
3586
3602
  stylistic: stylisticOptions,
3603
+ typescript: hasTypeScript,
3587
3604
  }), jsdoc({
3588
3605
  stylistic: stylisticOptions,
3589
3606
  }), promise(), regexp(), sonar(functionalConfigOptions), comments(), unicorn(), node());
@@ -3686,7 +3703,7 @@ async function rsEslint(options, ...userConfigs) {
3686
3703
  if (autoRenamePlugins) {
3687
3704
  m_composer = m_composer.renamePlugins(defaultPluginRenaming);
3688
3705
  }
3689
- return m_composer;
3706
+ return m_composer.toConfigs();
3690
3707
  }
3691
3708
  function resolveSubOptions(options, key) {
3692
3709
  return (typeof options[key] === "boolean" || typeof options[key] === "string"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rebeccastevens/eslint-config",
3
- "version": "3.0.4",
3
+ "version": "3.0.6",
4
4
  "description": "My ESLint shareable config.",
5
5
  "keywords": [
6
6
  "eslint config"