@jsse/eslint-config 0.2.0 → 0.2.1

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/cli.cjs CHANGED
@@ -612,7 +612,7 @@ var CAC = class extends import_events.EventEmitter {
612
612
  var cac = (name = "") => new CAC(name);
613
613
 
614
614
  // package.json
615
- var version = "0.2.0";
615
+ var version = "0.2.1";
616
616
 
617
617
  // src/cli.ts
618
618
  var cli = cac("jsselint");
package/dist/cli.js CHANGED
@@ -588,7 +588,7 @@ var CAC = class extends EventEmitter {
588
588
  var cac = (name = "") => new CAC(name);
589
589
 
590
590
  // package.json
591
- var version = "0.2.0";
591
+ var version = "0.2.1";
592
592
 
593
593
  // src/cli.ts
594
594
  var cli = cac("jsselint");
package/dist/index.cjs CHANGED
@@ -2989,6 +2989,7 @@ __export(src_exports, {
2989
2989
  GLOB_JSON5: () => GLOB_JSON5,
2990
2990
  GLOB_JSONC: () => GLOB_JSONC,
2991
2991
  GLOB_JSX: () => GLOB_JSX,
2992
+ GLOB_JS_SRC_EXT: () => GLOB_JS_SRC_EXT,
2992
2993
  GLOB_LESS: () => GLOB_LESS,
2993
2994
  GLOB_MARKDOWN: () => GLOB_MARKDOWN,
2994
2995
  GLOB_MARKDOWN_CODE: () => GLOB_MARKDOWN_CODE,
@@ -3038,7 +3039,7 @@ module.exports = __toCommonJS(src_exports);
3038
3039
 
3039
3040
  // src/factory.ts
3040
3041
  var import_node_fs3 = __toESM(require("fs"), 1);
3041
- var import_node_process5 = __toESM(require("process"), 1);
3042
+ var import_node_process6 = __toESM(require("process"), 1);
3042
3043
 
3043
3044
  // node_modules/.pnpm/local-pkg@0.5.0/node_modules/local-pkg/dist/index.mjs
3044
3045
  var import_node_path2 = __toESM(require("path"), 1);
@@ -9953,6 +9954,7 @@ var log = new Lager();
9953
9954
 
9954
9955
  // src/globs.ts
9955
9956
  var GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
9957
+ var GLOB_JS_SRC_EXT = "?([cm])js?(x)";
9956
9958
  var GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
9957
9959
  var GLOB_JS = "**/*.?([cm])js";
9958
9960
  var GLOB_JSX = "**/*.?([cm])jsx";
@@ -10497,7 +10499,7 @@ var javascript = async (options) => {
10497
10499
  }
10498
10500
  },
10499
10501
  {
10500
- files: [`scripts/${GLOB_SRC}`, `cli.${GLOB_SRC_EXT}`],
10502
+ files: [`scripts/${GLOB_JS}`, `cli.${GLOB_JS_SRC_EXT}`],
10501
10503
  name: "jsse/scripts-overrides",
10502
10504
  rules: {
10503
10505
  "no-console": "off"
@@ -11329,12 +11331,7 @@ var prettier = async () => {
11329
11331
  // src/configs/ts/typescript-language-options.ts
11330
11332
  var import_node_process4 = __toESM(require("process"), 1);
11331
11333
  function typescriptLanguageOptions(options) {
11332
- const {
11333
- componentExts = [],
11334
- react: react2,
11335
- // parserOptionsOverride = {},
11336
- tsconfig
11337
- } = options || {};
11334
+ const { componentExts = [], react: react2, tsconfig } = options || {};
11338
11335
  const tsOptions = tsconfig ? {
11339
11336
  // project: Array.isArray(tsconfig) ? tsconfig : [tsconfig],
11340
11337
  projectService: {
@@ -11928,28 +11925,93 @@ var tailwind = async (options) => {
11928
11925
  ];
11929
11926
  };
11930
11927
 
11928
+ // src/configs/ts/parser.ts
11929
+ var import_node_process5 = __toESM(require("process"), 1);
11930
+ function typescriptParser(options) {
11931
+ const {
11932
+ componentExts = [],
11933
+ filesTypeAware: files = [GLOB_TS, GLOB_TSX],
11934
+ ignoresTypeAware: ignores2 = [GLOB_MARKDOWN],
11935
+ parserOptions: parserOptionsOverride = {},
11936
+ react: react2,
11937
+ tsconfig
11938
+ } = options;
11939
+ const typeAware = !!tsconfig;
11940
+ return {
11941
+ files,
11942
+ ...ignores2 ? { ignores: ignores2 } : {},
11943
+ languageOptions: {
11944
+ parser: parserTs,
11945
+ parserOptions: {
11946
+ extraFileExtensions: componentExts.map((ext) => `.${ext}`),
11947
+ jsxPragma: react2 ? "React" : void 0,
11948
+ sourceType: "module",
11949
+ ...typeAware ? {
11950
+ projectService: {
11951
+ allowDefaultProject: ["*.js"],
11952
+ defaultProject: tsconfig
11953
+ },
11954
+ tsconfigRootDir: import_node_process5.default.cwd().replaceAll("\\", "/")
11955
+ } : {},
11956
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
11957
+ ...parserOptionsOverride
11958
+ }
11959
+ },
11960
+ name: `jsse/typescript/${typeAware ? "type-aware-parser" : "parser"}`
11961
+ };
11962
+ }
11963
+
11931
11964
  // src/configs/ts/typescript.ts
11932
11965
  var typescript = async (options) => {
11933
11966
  const {
11934
11967
  componentExts = [],
11968
+ filesTypeAware = [GLOB_TS, GLOB_TSX],
11969
+ ignoresTypeAware = [GLOB_MARKDOWN],
11935
11970
  overrides = {},
11936
11971
  parserOptions = {},
11937
11972
  prefix,
11938
- react: react2,
11973
+ react: react2 = false,
11939
11974
  tsconfig: tsconfigPath,
11940
11975
  typeAware
11941
11976
  } = options ?? {};
11977
+ const parserConfigs = typeAware ? [
11978
+ typescriptParser({
11979
+ filesTypeAware,
11980
+ ignoresTypeAware,
11981
+ parserOptions,
11982
+ react: react2,
11983
+ tsconfig: tsconfigPath,
11984
+ typeAware: true
11985
+ }),
11986
+ typescriptParser({
11987
+ filesTypeAware,
11988
+ ignoresTypeAware,
11989
+ parserOptions,
11990
+ react: react2,
11991
+ tsconfig: tsconfigPath,
11992
+ typeAware: false
11993
+ })
11994
+ ] : [
11995
+ typescriptParser({
11996
+ filesTypeAware,
11997
+ ignoresTypeAware,
11998
+ parserOptions,
11999
+ react: react2,
12000
+ tsconfig: tsconfigPath,
12001
+ typeAware: false
12002
+ })
12003
+ ];
11942
12004
  const tsPrefix = prefix?.from ?? "@typescript-eslint";
11943
12005
  const tsPrefixTo = prefix?.to ?? "@typescript-eslint";
11944
- const tsrules = {
12006
+ const tsRules = {
11945
12007
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
11946
12008
  ...(import_eslint_plugin.default.configs["eslint-recommended"]?.overrides ?? [])[0]?.rules,
11947
12009
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
11948
12010
  ...import_eslint_plugin.default.configs.strict?.rules,
11949
12011
  "no-invalid-this": "off",
11950
- ...typescriptRules(
11951
- typeAware !== false && tsconfigPath ? { typeAware: true } : { typeAware: false }
11952
- ),
12012
+ ...typescriptRules({
12013
+ typeAware: false
12014
+ }),
11953
12015
  ...overrides
11954
12016
  };
11955
12017
  return [
@@ -11961,24 +12023,31 @@ var typescript = async (options) => {
11961
12023
  [tsPrefixTo]: import_eslint_plugin.default
11962
12024
  }
11963
12025
  },
11964
- // ...tseslint.configs.recommended,
11965
- {
11966
- // use ts parser for js files as well!
11967
- files: [GLOB_SRC, ...componentExts.map((ext) => `**/*.${ext}`)],
11968
- languageOptions: typescriptLanguageOptions({
11969
- parserOptions,
11970
- react: react2,
11971
- tsconfig: tsconfigPath
11972
- }),
11973
- name: "jsse/typescript/parser"
11974
- },
12026
+ ...parserConfigs,
11975
12027
  {
11976
12028
  // only apply ts rules to ts files!
11977
12029
  files: [GLOB_TS, GLOB_TSX, ...componentExts.map((ext) => `**/*.${ext}`)],
11978
12030
  name: "jsse/typescript/rules",
11979
12031
  // may not need to rename all rules here........
11980
- rules: renameRules(tsrules || {}, tsPrefix, tsPrefixTo)
12032
+ rules: renameRules(tsRules || {}, tsPrefix, tsPrefixTo)
11981
12033
  },
12034
+ ...typeAware ? [
12035
+ {
12036
+ files: filesTypeAware,
12037
+ ignores: ignoresTypeAware,
12038
+ name: "jsse/typescript/rules-type-aware",
12039
+ rules: renameRules(
12040
+ {
12041
+ ...typescriptRules({
12042
+ typeAware: true
12043
+ }),
12044
+ ...overrides
12045
+ },
12046
+ tsPrefix,
12047
+ tsPrefixTo
12048
+ )
12049
+ }
12050
+ ] : [],
11982
12051
  {
11983
12052
  files: ["**/*.d.ts"],
11984
12053
  name: "jsse/typescript:disables/dts",
@@ -12243,11 +12312,11 @@ var flatConfigProps = [
12243
12312
  "rules",
12244
12313
  "settings"
12245
12314
  ];
12246
- var DEBUG = !!(import_node_process5.default.env.DEBUG?.toLowerCase() === "true" || import_node_process5.default.env.DEBUG === "1");
12315
+ var DEBUG = !!(import_node_process6.default.env.DEBUG?.toLowerCase() === "true" || import_node_process6.default.env.DEBUG === "1");
12247
12316
  function defaultOptions2() {
12248
12317
  return {
12249
12318
  componentExts: [],
12250
- debug: DEBUG && import_node_process5.default.env.TEST !== "true",
12319
+ debug: DEBUG && import_node_process6.default.env.TEST !== "true",
12251
12320
  fast: false,
12252
12321
  gitignore: true,
12253
12322
  isInEditor: isInEditor(),
@@ -12523,6 +12592,7 @@ function jsseReact() {
12523
12592
  GLOB_JSON5,
12524
12593
  GLOB_JSONC,
12525
12594
  GLOB_JSX,
12595
+ GLOB_JS_SRC_EXT,
12526
12596
  GLOB_LESS,
12527
12597
  GLOB_MARKDOWN,
12528
12598
  GLOB_MARKDOWN_CODE,
package/dist/index.d.cts CHANGED
@@ -20541,8 +20541,8 @@ type RuleOptionsUnion = BuiltinsRuleOptions &
20541
20541
 
20542
20542
  type Awaitable<T> = T | Promise<T>;
20543
20543
  type Rules = RuleOptionsUnion;
20544
- type LanguageOptions = Linter.FlatConfig["languageOptions"];
20545
- type TypedFlatConfigItem = Omit<Linter.FlatConfig, "plugins" | "rules"> & {
20544
+ type LanguageOptions = Linter.Config["languageOptions"];
20545
+ type TypedFlatConfigItem = Omit<Linter.Config<Linter.RulesRecord & Rules>, "plugins" | "rules"> & {
20546
20546
  /**
20547
20547
  * Custom name of each config item
20548
20548
  */
@@ -20568,6 +20568,12 @@ type OptionsCommon = {
20568
20568
  * @default "jsse"
20569
20569
  */
20570
20570
  rootName?: string;
20571
+ /**
20572
+ * Type of the project. `lib` will enable more strict rules for libraries.
20573
+ *
20574
+ * @default 'lib'
20575
+ */
20576
+ type?: "app" | "lib";
20571
20577
  };
20572
20578
  type OptionsComponentExts = {
20573
20579
  /**
@@ -20591,6 +20597,16 @@ type OptionsTypeScriptParserOptions = {
20591
20597
  * Additional parser options for TypeScript.
20592
20598
  */
20593
20599
  parserOptions?: Partial<ParserOptions>;
20600
+ /**
20601
+ * Glob patterns for files that should be type aware.
20602
+ * @default ['**\/*.{ts,tsx}']
20603
+ */
20604
+ filesTypeAware?: string[];
20605
+ /**
20606
+ * Glob patterns for files that should not be type aware.
20607
+ * @default ['**\/*.md\/**']
20608
+ */
20609
+ ignoresTypeAware?: string[];
20594
20610
  };
20595
20611
  type OptionsTypeScriptWithTypes = {
20596
20612
  /**
@@ -20760,7 +20776,7 @@ type OptionsConfig = {
20760
20776
  markdown?: TypedFlatConfigItem["rules"];
20761
20777
  yaml?: TypedFlatConfigItem["rules"];
20762
20778
  };
20763
- } & OptionsComponentExts;
20779
+ } & OptionsComponentExts & OptionsTypeScriptParserOptions;
20764
20780
  type RenamePefix<T extends Record<string, unknown>, FromPref extends string, ToPref extends string> = {
20765
20781
  [K in keyof T as K extends `${FromPref}${infer Rest}` ? `${ToPref}${Rest}` : K]: T[K];
20766
20782
  };
@@ -20771,6 +20787,7 @@ type RenamePefix<T extends Record<string, unknown>, FromPref extends string, ToP
20771
20787
  declare function jsse(options?: OptionsConfig & TypedFlatConfigItem, ...userConfigs: (TypedFlatConfigItem | TypedFlatConfigItem[])[]): Promise<TypedFlatConfigItem[]>;
20772
20788
 
20773
20789
  declare const GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
20790
+ declare const GLOB_JS_SRC_EXT = "?([cm])js?(x)";
20774
20791
  declare const GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
20775
20792
  declare const GLOB_JS = "**/*.?([cm])js";
20776
20793
  declare const GLOB_JSX = "**/*.?([cm])jsx";
@@ -21779,4 +21796,4 @@ declare function isInEditor(): boolean;
21779
21796
  declare function jssestd(): Promise<TypedFlatConfigItem[]>;
21780
21797
  declare function jsseReact(): Promise<TypedFlatConfigItem[]>;
21781
21798
 
21782
- export { type Awaitable, type EslintConfigFn, GLOB_ALL_SRC, GLOB_CSS, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_YAML, type LanguageOptions, type OptionsCommon, type OptionsComponentExts, type OptionsConfig, type OptionsFiles, type OptionsHasTypeScript, type OptionsIsInEditor, type OptionsOverrides, type OptionsPrefix, type OptionsReact, type OptionsStylistic, type OptionsTypeScriptParserOptions, type OptionsTypeScriptWithTypes, type PromiseFlatConfigItem, type RenamePefix, type Rules, type StylisticConfig, type TailwindEslintSettings, type TailwindOptions, type TypedFlatConfigItem, combine, combineAsync, jsse as default, importJsoncLibs, importParserJsonc, importPluginJsdoc, importPluginJsonc, importPluginMarkdown, importPluginReact, importPluginReactHooks, importPluginReactRefresh, importPluginStylistic, importPluginTailwind, importPluginTsdoc, importReactPlugins, importYmlLibs, interopDefault, isCI, isInEditor, jsse, jsseReact, jssestd, renameRules };
21799
+ export { type Awaitable, type EslintConfigFn, GLOB_ALL_SRC, GLOB_CSS, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_JS_SRC_EXT, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_YAML, type LanguageOptions, type OptionsCommon, type OptionsComponentExts, type OptionsConfig, type OptionsFiles, type OptionsHasTypeScript, type OptionsIsInEditor, type OptionsOverrides, type OptionsPrefix, type OptionsReact, type OptionsStylistic, type OptionsTypeScriptParserOptions, type OptionsTypeScriptWithTypes, type PromiseFlatConfigItem, type RenamePefix, type Rules, type StylisticConfig, type TailwindEslintSettings, type TailwindOptions, type TypedFlatConfigItem, combine, combineAsync, jsse as default, importJsoncLibs, importParserJsonc, importPluginJsdoc, importPluginJsonc, importPluginMarkdown, importPluginReact, importPluginReactHooks, importPluginReactRefresh, importPluginStylistic, importPluginTailwind, importPluginTsdoc, importReactPlugins, importYmlLibs, interopDefault, isCI, isInEditor, jsse, jsseReact, jssestd, renameRules };
package/dist/index.d.ts CHANGED
@@ -20541,8 +20541,8 @@ type RuleOptionsUnion = BuiltinsRuleOptions &
20541
20541
 
20542
20542
  type Awaitable<T> = T | Promise<T>;
20543
20543
  type Rules = RuleOptionsUnion;
20544
- type LanguageOptions = Linter.FlatConfig["languageOptions"];
20545
- type TypedFlatConfigItem = Omit<Linter.FlatConfig, "plugins" | "rules"> & {
20544
+ type LanguageOptions = Linter.Config["languageOptions"];
20545
+ type TypedFlatConfigItem = Omit<Linter.Config<Linter.RulesRecord & Rules>, "plugins" | "rules"> & {
20546
20546
  /**
20547
20547
  * Custom name of each config item
20548
20548
  */
@@ -20568,6 +20568,12 @@ type OptionsCommon = {
20568
20568
  * @default "jsse"
20569
20569
  */
20570
20570
  rootName?: string;
20571
+ /**
20572
+ * Type of the project. `lib` will enable more strict rules for libraries.
20573
+ *
20574
+ * @default 'lib'
20575
+ */
20576
+ type?: "app" | "lib";
20571
20577
  };
20572
20578
  type OptionsComponentExts = {
20573
20579
  /**
@@ -20591,6 +20597,16 @@ type OptionsTypeScriptParserOptions = {
20591
20597
  * Additional parser options for TypeScript.
20592
20598
  */
20593
20599
  parserOptions?: Partial<ParserOptions>;
20600
+ /**
20601
+ * Glob patterns for files that should be type aware.
20602
+ * @default ['**\/*.{ts,tsx}']
20603
+ */
20604
+ filesTypeAware?: string[];
20605
+ /**
20606
+ * Glob patterns for files that should not be type aware.
20607
+ * @default ['**\/*.md\/**']
20608
+ */
20609
+ ignoresTypeAware?: string[];
20594
20610
  };
20595
20611
  type OptionsTypeScriptWithTypes = {
20596
20612
  /**
@@ -20760,7 +20776,7 @@ type OptionsConfig = {
20760
20776
  markdown?: TypedFlatConfigItem["rules"];
20761
20777
  yaml?: TypedFlatConfigItem["rules"];
20762
20778
  };
20763
- } & OptionsComponentExts;
20779
+ } & OptionsComponentExts & OptionsTypeScriptParserOptions;
20764
20780
  type RenamePefix<T extends Record<string, unknown>, FromPref extends string, ToPref extends string> = {
20765
20781
  [K in keyof T as K extends `${FromPref}${infer Rest}` ? `${ToPref}${Rest}` : K]: T[K];
20766
20782
  };
@@ -20771,6 +20787,7 @@ type RenamePefix<T extends Record<string, unknown>, FromPref extends string, ToP
20771
20787
  declare function jsse(options?: OptionsConfig & TypedFlatConfigItem, ...userConfigs: (TypedFlatConfigItem | TypedFlatConfigItem[])[]): Promise<TypedFlatConfigItem[]>;
20772
20788
 
20773
20789
  declare const GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
20790
+ declare const GLOB_JS_SRC_EXT = "?([cm])js?(x)";
20774
20791
  declare const GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
20775
20792
  declare const GLOB_JS = "**/*.?([cm])js";
20776
20793
  declare const GLOB_JSX = "**/*.?([cm])jsx";
@@ -21779,4 +21796,4 @@ declare function isInEditor(): boolean;
21779
21796
  declare function jssestd(): Promise<TypedFlatConfigItem[]>;
21780
21797
  declare function jsseReact(): Promise<TypedFlatConfigItem[]>;
21781
21798
 
21782
- export { type Awaitable, type EslintConfigFn, GLOB_ALL_SRC, GLOB_CSS, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_YAML, type LanguageOptions, type OptionsCommon, type OptionsComponentExts, type OptionsConfig, type OptionsFiles, type OptionsHasTypeScript, type OptionsIsInEditor, type OptionsOverrides, type OptionsPrefix, type OptionsReact, type OptionsStylistic, type OptionsTypeScriptParserOptions, type OptionsTypeScriptWithTypes, type PromiseFlatConfigItem, type RenamePefix, type Rules, type StylisticConfig, type TailwindEslintSettings, type TailwindOptions, type TypedFlatConfigItem, combine, combineAsync, jsse as default, importJsoncLibs, importParserJsonc, importPluginJsdoc, importPluginJsonc, importPluginMarkdown, importPluginReact, importPluginReactHooks, importPluginReactRefresh, importPluginStylistic, importPluginTailwind, importPluginTsdoc, importReactPlugins, importYmlLibs, interopDefault, isCI, isInEditor, jsse, jsseReact, jssestd, renameRules };
21799
+ export { type Awaitable, type EslintConfigFn, GLOB_ALL_SRC, GLOB_CSS, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_JS_SRC_EXT, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_YAML, type LanguageOptions, type OptionsCommon, type OptionsComponentExts, type OptionsConfig, type OptionsFiles, type OptionsHasTypeScript, type OptionsIsInEditor, type OptionsOverrides, type OptionsPrefix, type OptionsReact, type OptionsStylistic, type OptionsTypeScriptParserOptions, type OptionsTypeScriptWithTypes, type PromiseFlatConfigItem, type RenamePefix, type Rules, type StylisticConfig, type TailwindEslintSettings, type TailwindOptions, type TypedFlatConfigItem, combine, combineAsync, jsse as default, importJsoncLibs, importParserJsonc, importPluginJsdoc, importPluginJsonc, importPluginMarkdown, importPluginReact, importPluginReactHooks, importPluginReactRefresh, importPluginStylistic, importPluginTailwind, importPluginTsdoc, importReactPlugins, importYmlLibs, interopDefault, isCI, isInEditor, jsse, jsseReact, jssestd, renameRules };
package/dist/index.js CHANGED
@@ -2973,7 +2973,7 @@ var require_globals2 = __commonJS({
2973
2973
 
2974
2974
  // src/factory.ts
2975
2975
  import fs2 from "fs";
2976
- import process5 from "process";
2976
+ import process6 from "process";
2977
2977
 
2978
2978
  // node_modules/.pnpm/local-pkg@0.5.0/node_modules/local-pkg/dist/index.mjs
2979
2979
  import path3, { dirname as dirname3, win32, join as join2 } from "path";
@@ -9885,6 +9885,7 @@ var log = new Lager();
9885
9885
 
9886
9886
  // src/globs.ts
9887
9887
  var GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
9888
+ var GLOB_JS_SRC_EXT = "?([cm])js?(x)";
9888
9889
  var GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
9889
9890
  var GLOB_JS = "**/*.?([cm])js";
9890
9891
  var GLOB_JSX = "**/*.?([cm])jsx";
@@ -10429,7 +10430,7 @@ var javascript = async (options) => {
10429
10430
  }
10430
10431
  },
10431
10432
  {
10432
- files: [`scripts/${GLOB_SRC}`, `cli.${GLOB_SRC_EXT}`],
10433
+ files: [`scripts/${GLOB_JS}`, `cli.${GLOB_JS_SRC_EXT}`],
10433
10434
  name: "jsse/scripts-overrides",
10434
10435
  rules: {
10435
10436
  "no-console": "off"
@@ -11261,12 +11262,7 @@ var prettier = async () => {
11261
11262
  // src/configs/ts/typescript-language-options.ts
11262
11263
  import process4 from "process";
11263
11264
  function typescriptLanguageOptions(options) {
11264
- const {
11265
- componentExts = [],
11266
- react: react2,
11267
- // parserOptionsOverride = {},
11268
- tsconfig
11269
- } = options || {};
11265
+ const { componentExts = [], react: react2, tsconfig } = options || {};
11270
11266
  const tsOptions = tsconfig ? {
11271
11267
  // project: Array.isArray(tsconfig) ? tsconfig : [tsconfig],
11272
11268
  projectService: {
@@ -11860,28 +11856,93 @@ var tailwind = async (options) => {
11860
11856
  ];
11861
11857
  };
11862
11858
 
11859
+ // src/configs/ts/parser.ts
11860
+ import process5 from "process";
11861
+ function typescriptParser(options) {
11862
+ const {
11863
+ componentExts = [],
11864
+ filesTypeAware: files = [GLOB_TS, GLOB_TSX],
11865
+ ignoresTypeAware: ignores2 = [GLOB_MARKDOWN],
11866
+ parserOptions: parserOptionsOverride = {},
11867
+ react: react2,
11868
+ tsconfig
11869
+ } = options;
11870
+ const typeAware = !!tsconfig;
11871
+ return {
11872
+ files,
11873
+ ...ignores2 ? { ignores: ignores2 } : {},
11874
+ languageOptions: {
11875
+ parser: parserTs,
11876
+ parserOptions: {
11877
+ extraFileExtensions: componentExts.map((ext) => `.${ext}`),
11878
+ jsxPragma: react2 ? "React" : void 0,
11879
+ sourceType: "module",
11880
+ ...typeAware ? {
11881
+ projectService: {
11882
+ allowDefaultProject: ["*.js"],
11883
+ defaultProject: tsconfig
11884
+ },
11885
+ tsconfigRootDir: process5.cwd().replaceAll("\\", "/")
11886
+ } : {},
11887
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
11888
+ ...parserOptionsOverride
11889
+ }
11890
+ },
11891
+ name: `jsse/typescript/${typeAware ? "type-aware-parser" : "parser"}`
11892
+ };
11893
+ }
11894
+
11863
11895
  // src/configs/ts/typescript.ts
11864
11896
  var typescript = async (options) => {
11865
11897
  const {
11866
11898
  componentExts = [],
11899
+ filesTypeAware = [GLOB_TS, GLOB_TSX],
11900
+ ignoresTypeAware = [GLOB_MARKDOWN],
11867
11901
  overrides = {},
11868
11902
  parserOptions = {},
11869
11903
  prefix,
11870
- react: react2,
11904
+ react: react2 = false,
11871
11905
  tsconfig: tsconfigPath,
11872
11906
  typeAware
11873
11907
  } = options ?? {};
11908
+ const parserConfigs = typeAware ? [
11909
+ typescriptParser({
11910
+ filesTypeAware,
11911
+ ignoresTypeAware,
11912
+ parserOptions,
11913
+ react: react2,
11914
+ tsconfig: tsconfigPath,
11915
+ typeAware: true
11916
+ }),
11917
+ typescriptParser({
11918
+ filesTypeAware,
11919
+ ignoresTypeAware,
11920
+ parserOptions,
11921
+ react: react2,
11922
+ tsconfig: tsconfigPath,
11923
+ typeAware: false
11924
+ })
11925
+ ] : [
11926
+ typescriptParser({
11927
+ filesTypeAware,
11928
+ ignoresTypeAware,
11929
+ parserOptions,
11930
+ react: react2,
11931
+ tsconfig: tsconfigPath,
11932
+ typeAware: false
11933
+ })
11934
+ ];
11874
11935
  const tsPrefix = prefix?.from ?? "@typescript-eslint";
11875
11936
  const tsPrefixTo = prefix?.to ?? "@typescript-eslint";
11876
- const tsrules = {
11937
+ const tsRules = {
11877
11938
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
11878
11939
  ...(default8.configs["eslint-recommended"]?.overrides ?? [])[0]?.rules,
11879
11940
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
11880
11941
  ...default8.configs.strict?.rules,
11881
11942
  "no-invalid-this": "off",
11882
- ...typescriptRules(
11883
- typeAware !== false && tsconfigPath ? { typeAware: true } : { typeAware: false }
11884
- ),
11943
+ ...typescriptRules({
11944
+ typeAware: false
11945
+ }),
11885
11946
  ...overrides
11886
11947
  };
11887
11948
  return [
@@ -11893,24 +11954,31 @@ var typescript = async (options) => {
11893
11954
  [tsPrefixTo]: default8
11894
11955
  }
11895
11956
  },
11896
- // ...tseslint.configs.recommended,
11897
- {
11898
- // use ts parser for js files as well!
11899
- files: [GLOB_SRC, ...componentExts.map((ext) => `**/*.${ext}`)],
11900
- languageOptions: typescriptLanguageOptions({
11901
- parserOptions,
11902
- react: react2,
11903
- tsconfig: tsconfigPath
11904
- }),
11905
- name: "jsse/typescript/parser"
11906
- },
11957
+ ...parserConfigs,
11907
11958
  {
11908
11959
  // only apply ts rules to ts files!
11909
11960
  files: [GLOB_TS, GLOB_TSX, ...componentExts.map((ext) => `**/*.${ext}`)],
11910
11961
  name: "jsse/typescript/rules",
11911
11962
  // may not need to rename all rules here........
11912
- rules: renameRules(tsrules || {}, tsPrefix, tsPrefixTo)
11963
+ rules: renameRules(tsRules || {}, tsPrefix, tsPrefixTo)
11913
11964
  },
11965
+ ...typeAware ? [
11966
+ {
11967
+ files: filesTypeAware,
11968
+ ignores: ignoresTypeAware,
11969
+ name: "jsse/typescript/rules-type-aware",
11970
+ rules: renameRules(
11971
+ {
11972
+ ...typescriptRules({
11973
+ typeAware: true
11974
+ }),
11975
+ ...overrides
11976
+ },
11977
+ tsPrefix,
11978
+ tsPrefixTo
11979
+ )
11980
+ }
11981
+ ] : [],
11914
11982
  {
11915
11983
  files: ["**/*.d.ts"],
11916
11984
  name: "jsse/typescript:disables/dts",
@@ -12175,11 +12243,11 @@ var flatConfigProps = [
12175
12243
  "rules",
12176
12244
  "settings"
12177
12245
  ];
12178
- var DEBUG = !!(process5.env.DEBUG?.toLowerCase() === "true" || process5.env.DEBUG === "1");
12246
+ var DEBUG = !!(process6.env.DEBUG?.toLowerCase() === "true" || process6.env.DEBUG === "1");
12179
12247
  function defaultOptions2() {
12180
12248
  return {
12181
12249
  componentExts: [],
12182
- debug: DEBUG && process5.env.TEST !== "true",
12250
+ debug: DEBUG && process6.env.TEST !== "true",
12183
12251
  fast: false,
12184
12252
  gitignore: true,
12185
12253
  isInEditor: isInEditor(),
@@ -12454,6 +12522,7 @@ export {
12454
12522
  GLOB_JSON5,
12455
12523
  GLOB_JSONC,
12456
12524
  GLOB_JSX,
12525
+ GLOB_JS_SRC_EXT,
12457
12526
  GLOB_LESS,
12458
12527
  GLOB_MARKDOWN,
12459
12528
  GLOB_MARKDOWN_CODE,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@jsse/eslint-config",
3
3
  "type": "module",
4
- "version": "0.2.0",
4
+ "version": "0.2.1",
5
5
  "description": "@jsse/eslint-config ~ WYSIWYG",
6
6
  "author": "jessekrubin <jessekrubin@gmail.com> (https://github.com/jessekrubin/)",
7
7
  "license": "MIT",
@@ -60,7 +60,7 @@
60
60
  "dependencies": {
61
61
  "@eslint/js": "~9.8.0",
62
62
  "@stylistic/eslint-plugin": "2.6.1",
63
- "@typescript-eslint/eslint-plugin": "^8.0.1",
63
+ "@typescript-eslint/eslint-plugin": "^8.0.0",
64
64
  "@typescript-eslint/parser": "^8.0.1",
65
65
  "eslint-config-flat-gitignore": "^0.1.8",
66
66
  "eslint-define-config": "^2.1.0",