@jsse/eslint-config 0.1.22 → 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.1.22";
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.1.22";
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"
@@ -10637,7 +10639,7 @@ function typescriptRulesTypeAware() {
10637
10639
  "@typescript-eslint/no-unnecessary-qualifier": "error",
10638
10640
  "@typescript-eslint/no-unnecessary-type-arguments": "off",
10639
10641
  "@typescript-eslint/no-unnecessary-type-assertion": "error",
10640
- "@typescript-eslint/no-useless-template-literals": "error",
10642
+ // "@typescript-eslint/no-useless-template-literals": "error",
10641
10643
  "no-throw-literal": "off",
10642
10644
  "@typescript-eslint/only-throw-error": "error",
10643
10645
  "@typescript-eslint/no-unsafe-argument": "error",
@@ -10780,56 +10782,61 @@ function typescriptRulesTypeOblivious() {
10780
10782
  }
10781
10783
  ],
10782
10784
  "@typescript-eslint/adjacent-overload-signatures": "error",
10783
- "@typescript-eslint/ban-types": [
10784
- "warn",
10785
- {
10786
- extendDefaults: false,
10787
- types: {
10788
- String: {
10789
- message: 'Use "string" instead',
10790
- fixWith: "string"
10791
- },
10792
- Boolean: {
10793
- message: 'Use "boolean" instead',
10794
- fixWith: "boolean"
10795
- },
10796
- Number: {
10797
- message: 'Use "number" instead',
10798
- fixWith: "number"
10799
- },
10800
- BigInt: {
10801
- message: "Use `bigint` instead.",
10802
- fixWith: "bigint"
10803
- },
10804
- Object: {
10805
- message: "The `Object` type is mostly the same as `unknown`. You probably want `Record<string, unknown>` instead. See https://github.com/typescript-eslint/typescript-eslint/pull/848",
10806
- fixWith: "Record<string, unknown>"
10807
- },
10808
- object: {
10809
- message: "The `object` type is hard to use. Use `Record<string, unknown>` instead. See: https://github.com/typescript-eslint/typescript-eslint/pull/848",
10810
- fixWith: "Record<string, unknown>"
10811
- },
10812
- Symbol: {
10813
- message: 'Use "symbol" instead',
10814
- fixWith: "symbol"
10815
- },
10816
- Function: {
10817
- message: 'The "Function" type accepts any function-like value.\nIt provides no type safety when calling the function, which can be a common source of bugs.\nIt also accepts things like class declarations, which will throw at runtime as they will not be called with "new".\nIf you are expecting the function to accept certain arguments, you should explicitly define the function shape.'
10818
- },
10819
- // eslint-disable-next-line @typescript-eslint/naming-convention
10820
- "{}": {
10821
- message: "The `{}` type is mostly the same as `unknown`. You probably want `Record<string, unknown>` instead.",
10822
- fixWith: "Record<string, unknown>"
10823
- },
10824
- // eslint-disable-next-line @typescript-eslint/naming-convention
10825
- "[]": "Don't use the empty array type `[]`. It only allows empty arrays. Use `SomeType[]` instead.",
10826
- // eslint-disable-next-line @typescript-eslint/naming-convention
10827
- "[[]]": "Don't use `[[]]`. It only allows an array with a single element which is an empty array. Use `SomeType[][]` instead.",
10828
- // eslint-disable-next-line @typescript-eslint/naming-convention
10829
- "[[[]]]": "Don't use `[[[]]]`. Use `SomeType[][][]` instead."
10830
- }
10831
- }
10832
- ],
10785
+ // "@typescript-eslint/ban-types": [
10786
+ // "warn",
10787
+ // {
10788
+ // extendDefaults: false,
10789
+ // types: {
10790
+ // String: {
10791
+ // message: 'Use "string" instead',
10792
+ // fixWith: "string",
10793
+ // },
10794
+ // Boolean: {
10795
+ // message: 'Use "boolean" instead',
10796
+ // fixWith: "boolean",
10797
+ // },
10798
+ // Number: {
10799
+ // message: 'Use "number" instead',
10800
+ // fixWith: "number",
10801
+ // },
10802
+ // BigInt: {
10803
+ // message: "Use `bigint` instead.",
10804
+ // fixWith: "bigint",
10805
+ // },
10806
+ // Object: {
10807
+ // message:
10808
+ // "The `Object` type is mostly the same as `unknown`. You probably want `Record<string, unknown>` instead. See https://github.com/typescript-eslint/typescript-eslint/pull/848",
10809
+ // fixWith: "Record<string, unknown>",
10810
+ // },
10811
+ // object: {
10812
+ // message:
10813
+ // "The `object` type is hard to use. Use `Record<string, unknown>` instead. See: https://github.com/typescript-eslint/typescript-eslint/pull/848",
10814
+ // fixWith: "Record<string, unknown>",
10815
+ // },
10816
+ // Symbol: {
10817
+ // message: 'Use "symbol" instead',
10818
+ // fixWith: "symbol",
10819
+ // },
10820
+ // Function: {
10821
+ // message:
10822
+ // 'The "Function" type accepts any function-like value.\nIt provides no type safety when calling the function, which can be a common source of bugs.\nIt also accepts things like class declarations, which will throw at runtime as they will not be called with "new".\nIf you are expecting the function to accept certain arguments, you should explicitly define the function shape.',
10823
+ // },
10824
+ // // eslint-disable-next-line @typescript-eslint/naming-convention
10825
+ // "{}": {
10826
+ // message:
10827
+ // "The `{}` type is mostly the same as `unknown`. You probably want `Record<string, unknown>` instead.",
10828
+ // fixWith: "Record<string, unknown>",
10829
+ // },
10830
+ // // eslint-disable-next-line @typescript-eslint/naming-convention
10831
+ // "[]": "Don't use the empty array type `[]`. It only allows empty arrays. Use `SomeType[]` instead.",
10832
+ // // eslint-disable-next-line @typescript-eslint/naming-convention
10833
+ // "[[]]":
10834
+ // "Don't use `[[]]`. It only allows an array with a single element which is an empty array. Use `SomeType[][]` instead.",
10835
+ // // eslint-disable-next-line @typescript-eslint/naming-convention
10836
+ // "[[[]]]": "Don't use `[[[]]]`. Use `SomeType[][][]` instead.",
10837
+ // },
10838
+ // },
10839
+ // ],
10833
10840
  "@typescript-eslint/consistent-type-assertions": "error",
10834
10841
  "@typescript-eslint/consistent-type-definitions": ["error", "type"],
10835
10842
  "@typescript-eslint/member-ordering": [
@@ -10979,29 +10986,28 @@ function typescriptRulesTypeOblivious() {
10979
10986
  ],
10980
10987
  "default-param-last": "off",
10981
10988
  "@typescript-eslint/default-param-last": "error",
10982
- "func-call-spacing": "off",
10989
+ // "func-call-spacing": "off",
10983
10990
  "@typescript-eslint/func-call-spacing": ["error", "never"],
10984
- "keyword-spacing": "off",
10991
+ // "keyword-spacing": "off",
10985
10992
  "@typescript-eslint/keyword-spacing": "error",
10986
- "lines-between-class-members": "off",
10987
- "@typescript-eslint/lines-between-class-members": [
10988
- "error",
10989
- "always",
10990
- {
10991
- exceptAfterSingleLine: true
10992
- }
10993
- ],
10993
+ // "lines-between-class-members": "off",
10994
+ // "@typescript-eslint/lines-between-class-members": [
10995
+ // "error",
10996
+ // "always",
10997
+ // {
10998
+ // exceptAfterSingleLine: true,
10999
+ // },
11000
+ // ],
10994
11001
  "no-dupe-class-members": "off",
10995
11002
  "@typescript-eslint/no-dupe-class-members": "error",
10996
11003
  "no-empty-function": "off",
10997
11004
  "@typescript-eslint/no-empty-function": "error",
10998
- "no-extra-parens": "off",
10999
- "no-extra-semi": "off",
11005
+ // "no-extra-parens": "off",
11006
+ // "no-extra-semi": "off",
11000
11007
  "@typescript-eslint/no-extra-semi": "error",
11001
11008
  "no-loop-func": "off",
11002
11009
  "@typescript-eslint/no-loop-func": "error",
11003
11010
  "no-loss-of-precision": "off",
11004
- "@typescript-eslint/no-loss-of-precision": "error",
11005
11011
  "no-redeclare": "off",
11006
11012
  "@typescript-eslint/no-redeclare": "error",
11007
11013
  "no-restricted-imports": "off",
@@ -11020,17 +11026,17 @@ function typescriptRulesTypeOblivious() {
11020
11026
  ]
11021
11027
  }
11022
11028
  ],
11023
- "padding-line-between-statements": "off",
11029
+ // "padding-line-between-statements": "off",
11024
11030
  "@typescript-eslint/padding-line-between-statements": "off",
11025
- quotes: "off",
11031
+ // quotes: "off",
11026
11032
  "@typescript-eslint/quotes": "off",
11027
- "space-before-function-paren": "off",
11033
+ // "space-before-function-paren": "off",
11028
11034
  "@typescript-eslint/space-before-function-paren": "off",
11029
- "space-infix-ops": "off",
11035
+ // "space-infix-ops": "off",
11030
11036
  "@typescript-eslint/space-infix-ops": "error",
11031
- semi: "off",
11037
+ // semi: "off",
11032
11038
  "@typescript-eslint/semi": ["error", "always"],
11033
- "space-before-blocks": "off",
11039
+ // "space-before-blocks": "off",
11034
11040
  "@typescript-eslint/space-before-blocks": ["error", "always"],
11035
11041
  "no-undef": "off",
11036
11042
  "no-duplicate-imports": "off",
@@ -11325,14 +11331,18 @@ var prettier = async () => {
11325
11331
  // src/configs/ts/typescript-language-options.ts
11326
11332
  var import_node_process4 = __toESM(require("process"), 1);
11327
11333
  function typescriptLanguageOptions(options) {
11328
- const {
11329
- componentExts = [],
11330
- react: react2,
11331
- // parserOptionsOverride = {},
11332
- tsconfig
11333
- } = options || {};
11334
+ const { componentExts = [], react: react2, tsconfig } = options || {};
11334
11335
  const tsOptions = tsconfig ? {
11335
- project: Array.isArray(tsconfig) ? tsconfig : [tsconfig],
11336
+ // project: Array.isArray(tsconfig) ? tsconfig : [tsconfig],
11337
+ projectService: {
11338
+ allowDefaultProject: [
11339
+ "*.js",
11340
+ "tsconfig.json",
11341
+ "*.ts",
11342
+ "scripts/*.ts"
11343
+ ],
11344
+ defaultProject: tsconfig
11345
+ },
11336
11346
  tsconfigRootDir: import_node_process4.default.cwd()
11337
11347
  } : {};
11338
11348
  const parserOptions = {
@@ -11915,28 +11925,93 @@ var tailwind = async (options) => {
11915
11925
  ];
11916
11926
  };
11917
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
+
11918
11964
  // src/configs/ts/typescript.ts
11919
11965
  var typescript = async (options) => {
11920
11966
  const {
11921
11967
  componentExts = [],
11968
+ filesTypeAware = [GLOB_TS, GLOB_TSX],
11969
+ ignoresTypeAware = [GLOB_MARKDOWN],
11922
11970
  overrides = {},
11923
11971
  parserOptions = {},
11924
11972
  prefix,
11925
- react: react2,
11973
+ react: react2 = false,
11926
11974
  tsconfig: tsconfigPath,
11927
11975
  typeAware
11928
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
+ ];
11929
12004
  const tsPrefix = prefix?.from ?? "@typescript-eslint";
11930
12005
  const tsPrefixTo = prefix?.to ?? "@typescript-eslint";
11931
- const tsrules = {
12006
+ const tsRules = {
11932
12007
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
11933
12008
  ...(import_eslint_plugin.default.configs["eslint-recommended"]?.overrides ?? [])[0]?.rules,
11934
12009
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
11935
12010
  ...import_eslint_plugin.default.configs.strict?.rules,
11936
12011
  "no-invalid-this": "off",
11937
- ...typescriptRules(
11938
- typeAware !== false && tsconfigPath ? { typeAware: true } : { typeAware: false }
11939
- ),
12012
+ ...typescriptRules({
12013
+ typeAware: false
12014
+ }),
11940
12015
  ...overrides
11941
12016
  };
11942
12017
  return [
@@ -11948,23 +12023,31 @@ var typescript = async (options) => {
11948
12023
  [tsPrefixTo]: import_eslint_plugin.default
11949
12024
  }
11950
12025
  },
11951
- // ...tseslint.configs.recommended,
11952
- {
11953
- // use ts parser for js files as well!
11954
- files: [GLOB_SRC, ...componentExts.map((ext) => `**/*.${ext}`)],
11955
- languageOptions: typescriptLanguageOptions({
11956
- parserOptions,
11957
- react: react2,
11958
- tsconfig: tsconfigPath
11959
- }),
11960
- name: "jsse/typescript/parser"
11961
- },
12026
+ ...parserConfigs,
11962
12027
  {
11963
12028
  // only apply ts rules to ts files!
11964
12029
  files: [GLOB_TS, GLOB_TSX, ...componentExts.map((ext) => `**/*.${ext}`)],
11965
12030
  name: "jsse/typescript/rules",
11966
- rules: renameRules(tsrules || {}, tsPrefix, tsPrefixTo)
12031
+ // may not need to rename all rules here........
12032
+ rules: renameRules(tsRules || {}, tsPrefix, tsPrefixTo)
11967
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
+ ] : [],
11968
12051
  {
11969
12052
  files: ["**/*.d.ts"],
11970
12053
  name: "jsse/typescript:disables/dts",
@@ -12229,11 +12312,11 @@ var flatConfigProps = [
12229
12312
  "rules",
12230
12313
  "settings"
12231
12314
  ];
12232
- 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");
12233
12316
  function defaultOptions2() {
12234
12317
  return {
12235
12318
  componentExts: [],
12236
- debug: DEBUG && import_node_process5.default.env.TEST !== "true",
12319
+ debug: DEBUG && import_node_process6.default.env.TEST !== "true",
12237
12320
  fast: false,
12238
12321
  gitignore: true,
12239
12322
  isInEditor: isInEditor(),
@@ -12461,6 +12544,24 @@ async function jsse(options = {}, ...userConfigs) {
12461
12544
  return res;
12462
12545
  }
12463
12546
  }
12547
+ for (const config of combinedConfigs) {
12548
+ if (config.plugins) {
12549
+ for (const [key, value] of Object.entries(config.plugins)) {
12550
+ if (key.startsWith("@typescript-eslint/")) {
12551
+ delete config.plugins[key];
12552
+ config.plugins[`${tsPrefix}/${key.slice("@typescript-eslint/".length)}`] = value;
12553
+ }
12554
+ }
12555
+ }
12556
+ if (config.rules) {
12557
+ for (const [key, value] of Object.entries(config.rules)) {
12558
+ if (key.startsWith("@typescript-eslint/")) {
12559
+ delete config.rules[key];
12560
+ config.rules[`${tsPrefix}/${key.slice("@typescript-eslint/".length)}`] = value;
12561
+ }
12562
+ }
12563
+ }
12564
+ }
12464
12565
  return combinedConfigs;
12465
12566
  }
12466
12567
 
@@ -12491,6 +12592,7 @@ function jsseReact() {
12491
12592
  GLOB_JSON5,
12492
12593
  GLOB_JSONC,
12493
12594
  GLOB_JSX,
12595
+ GLOB_JS_SRC_EXT,
12494
12596
  GLOB_LESS,
12495
12597
  GLOB_MARKDOWN,
12496
12598
  GLOB_MARKDOWN_CODE,