@jsse/eslint-config 0.2.9 → 0.2.11

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.9";
615
+ var version = "0.2.11";
616
616
 
617
617
  // src/cli.ts
618
618
  var cli = cac("jsselint");
package/dist/cli.js CHANGED
@@ -1,6 +1,6 @@
1
1
  // src/cli.ts
2
- import fs from "fs";
3
- import process2 from "process";
2
+ import fs from "node:fs";
3
+ import process2 from "node:process";
4
4
 
5
5
  // node_modules/.pnpm/cac@6.7.14/node_modules/cac/dist/index.mjs
6
6
  import { EventEmitter } from "events";
@@ -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.9";
591
+ var version = "0.2.11";
592
592
 
593
593
  // src/cli.ts
594
594
  var cli = cac("jsselint");
package/dist/index.cjs CHANGED
@@ -2983,6 +2983,7 @@ __export(src_exports, {
2983
2983
  GLOB_ALL_SRC: () => GLOB_ALL_SRC,
2984
2984
  GLOB_CSS: () => GLOB_CSS,
2985
2985
  GLOB_EXCLUDE: () => GLOB_EXCLUDE,
2986
+ GLOB_GRAPHQL: () => GLOB_GRAPHQL,
2986
2987
  GLOB_HTML: () => GLOB_HTML,
2987
2988
  GLOB_JS: () => GLOB_JS,
2988
2989
  GLOB_JSON: () => GLOB_JSON,
@@ -3000,6 +3001,7 @@ __export(src_exports, {
3000
3001
  GLOB_TESTS: () => GLOB_TESTS,
3001
3002
  GLOB_TOML: () => GLOB_TOML,
3002
3003
  GLOB_TS: () => GLOB_TS,
3004
+ GLOB_TSCONFIG: () => GLOB_TSCONFIG,
3003
3005
  GLOB_TSX: () => GLOB_TSX,
3004
3006
  GLOB_YAML: () => GLOB_YAML,
3005
3007
  combine: () => combine,
@@ -3033,7 +3035,8 @@ __export(src_exports, {
3033
3035
  pluginTs: () => import_eslint_plugin.default,
3034
3036
  pluginUnicorn: () => import_eslint_plugin_unicorn.default,
3035
3037
  pluginUnusedImports: () => import_eslint_plugin_unused_imports.default,
3036
- renameRules: () => renameRules
3038
+ renameRules: () => renameRules,
3039
+ uniqueStrings: () => uniqueStrings
3037
3040
  });
3038
3041
  module.exports = __toCommonJS(src_exports);
3039
3042
 
@@ -3855,6 +3858,11 @@ pp$8.parseStatement = function(context, topLevel, exports2) {
3855
3858
  }
3856
3859
  }
3857
3860
  return starttype === types$1._import ? this.parseImport(node) : this.parseExport(node, exports2);
3861
+ // If the statement does not start with a statement keyword or a
3862
+ // brace, it's an ExpressionStatement or LabeledStatement. We
3863
+ // simply start parsing an expression, and afterwards, if the
3864
+ // next token is a colon and the expression was a simple
3865
+ // Identifier node, we switch to interpreting it as a label.
3858
3866
  default:
3859
3867
  if (this.isAsyncFunction()) {
3860
3868
  if (context) {
@@ -7908,8 +7916,11 @@ pp.readToken_numberSign = function() {
7908
7916
  };
7909
7917
  pp.getTokenFromCode = function(code) {
7910
7918
  switch (code) {
7919
+ // The interpretation of a dot depends on whether it is followed
7920
+ // by a digit or another two dots.
7911
7921
  case 46:
7912
7922
  return this.readToken_dot();
7923
+ // Punctuation tokens.
7913
7924
  case 40:
7914
7925
  ++this.pos;
7915
7926
  return this.finishToken(types$1.parenL);
@@ -7956,6 +7967,8 @@ pp.getTokenFromCode = function(code) {
7956
7967
  return this.readRadixNumber(2);
7957
7968
  }
7958
7969
  }
7970
+ // Anything else beginning with a digit is an integer, octal
7971
+ // number, or float.
7959
7972
  case 49:
7960
7973
  case 50:
7961
7974
  case 51:
@@ -7966,9 +7979,14 @@ pp.getTokenFromCode = function(code) {
7966
7979
  case 56:
7967
7980
  case 57:
7968
7981
  return this.readNumber(false);
7982
+ // Quotes produce strings.
7969
7983
  case 34:
7970
7984
  case 39:
7971
7985
  return this.readString(code);
7986
+ // Operators are parsed inline in tiny state machines. '=' (61) is
7987
+ // often referred to. `finishOp` simply skips the amount of
7988
+ // characters it is given as second argument, and returns a token
7989
+ // of the type given by its first argument.
7972
7990
  case 47:
7973
7991
  return this.readToken_slash();
7974
7992
  case 37:
@@ -8284,12 +8302,14 @@ pp.readInvalidTemplateToken = function() {
8284
8302
  if (this.input[this.pos + 1] !== "{") {
8285
8303
  break;
8286
8304
  }
8305
+ // fall through
8287
8306
  case "`":
8288
8307
  return this.finishToken(types$1.invalidTemplate, this.input.slice(this.start, this.pos));
8289
8308
  case "\r":
8290
8309
  if (this.input[this.pos + 1] === "\n") {
8291
8310
  ++this.pos;
8292
8311
  }
8312
+ // fall through
8293
8313
  case "\n":
8294
8314
  case "\u2028":
8295
8315
  case "\u2029":
@@ -8306,24 +8326,33 @@ pp.readEscapedChar = function(inTemplate) {
8306
8326
  switch (ch) {
8307
8327
  case 110:
8308
8328
  return "\n";
8329
+ // 'n' -> '\n'
8309
8330
  case 114:
8310
8331
  return "\r";
8332
+ // 'r' -> '\r'
8311
8333
  case 120:
8312
8334
  return String.fromCharCode(this.readHexChar(2));
8335
+ // 'x'
8313
8336
  case 117:
8314
8337
  return codePointToString(this.readCodePoint());
8338
+ // 'u'
8315
8339
  case 116:
8316
8340
  return " ";
8341
+ // 't' -> '\t'
8317
8342
  case 98:
8318
8343
  return "\b";
8344
+ // 'b' -> '\b'
8319
8345
  case 118:
8320
8346
  return "\v";
8347
+ // 'v' -> '\u000b'
8321
8348
  case 102:
8322
8349
  return "\f";
8350
+ // 'f' -> '\f'
8323
8351
  case 13:
8324
8352
  if (this.input.charCodeAt(this.pos) === 10) {
8325
8353
  ++this.pos;
8326
8354
  }
8355
+ // '\r\n'
8327
8356
  case 10:
8328
8357
  if (this.options.locations) {
8329
8358
  this.lineStart = this.pos;
@@ -9875,86 +9904,6 @@ function resolvePackage(name, options = {}) {
9875
9904
  }
9876
9905
  }
9877
9906
 
9878
- // src/lager.ts
9879
- var levels = {
9880
- trace: 10,
9881
- debug: 20,
9882
- info: 30,
9883
- warn: 40,
9884
- error: 50,
9885
- fatal: 60
9886
- };
9887
- function isLagerLevel(level) {
9888
- return level === "trace" || level === "debug" || level === "info" || level === "warn" || level === "error" || level === "fatal";
9889
- }
9890
- var Lager = class {
9891
- _level = "info";
9892
- id = "lager";
9893
- levelNo = levels[this._level];
9894
- prefix = "";
9895
- constructor(options) {
9896
- const { level, id, prefix } = {
9897
- level: "info",
9898
- id: "lager",
9899
- prefix: "@jsse/eslint-config",
9900
- ...options
9901
- };
9902
- this.id = id;
9903
- this._level = isLagerLevel(level) ? level : "info";
9904
- this.levelNo = levels[this._level];
9905
- this.prefix = prefix;
9906
- this.log = this.log.bind(this);
9907
- this.debug = this.debug.bind(this);
9908
- }
9909
- get level() {
9910
- return this._level;
9911
- }
9912
- set level(level) {
9913
- this._level = level;
9914
- this.levelNo = levels[level];
9915
- }
9916
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
9917
- log(...args) {
9918
- console.log(...args);
9919
- }
9920
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
9921
- trace(...args) {
9922
- if (this.levelNo > levels.trace) {
9923
- return;
9924
- }
9925
- console.trace(...args);
9926
- }
9927
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
9928
- debug(...args) {
9929
- if (this.levelNo > levels.debug) {
9930
- return;
9931
- }
9932
- console.debug(...args);
9933
- }
9934
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
9935
- info(...args) {
9936
- if (this.levelNo > levels.info) {
9937
- return;
9938
- }
9939
- console.info("[@jsse/eslint-config]", ...args);
9940
- }
9941
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
9942
- warn(...args) {
9943
- if (this.levelNo > levels.warn) {
9944
- return;
9945
- }
9946
- console.warn(...args);
9947
- }
9948
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
9949
- error(...args) {
9950
- if (this.levelNo > levels.error) {
9951
- return;
9952
- }
9953
- console.error(...args);
9954
- }
9955
- };
9956
- var log = new Lager();
9957
-
9958
9907
  // src/globs.ts
9959
9908
  var GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
9960
9909
  var GLOB_JS_SRC_EXT = "?([cm])js?(x)";
@@ -9972,8 +9921,10 @@ var GLOB_JSON5 = "**/*.json5";
9972
9921
  var GLOB_JSONC = "**/*.jsonc";
9973
9922
  var GLOB_TOML = "**/*.toml";
9974
9923
  var GLOB_MARKDOWN = "**/*.md";
9924
+ var GLOB_GRAPHQL = ["**/*.graphql", "**/*.gql"];
9975
9925
  var GLOB_YAML = "**/*.y?(a)ml";
9976
9926
  var GLOB_HTML = "**/*.htm?(l)";
9927
+ var GLOB_TSCONFIG = ["**/tsconfig.json", "**/tsconfig.*.json"];
9977
9928
  var GLOB_MARKDOWN_CODE = `${GLOB_MARKDOWN}/${GLOB_SRC}`;
9978
9929
  var GLOB_TESTS = [
9979
9930
  `**/__tests__/**/*.${GLOB_SRC_EXT}`,
@@ -10062,8 +10013,23 @@ function isCI() {
10062
10013
  function isInEditor() {
10063
10014
  return !!((import_node_process3.default.env.VSCODE_PID || import_node_process3.default.env.JETBRAINS_IDE) && !isCI());
10064
10015
  }
10016
+ function uniqueStrings(...strings) {
10017
+ const set = /* @__PURE__ */ new Set();
10018
+ for (const item of strings) {
10019
+ if (typeof item === "string") {
10020
+ set.add(item);
10021
+ } else {
10022
+ for (const str of item) {
10023
+ set.add(str);
10024
+ }
10025
+ }
10026
+ }
10027
+ return [...set];
10028
+ }
10065
10029
 
10066
10030
  // src/plugins.ts
10031
+ var import_eslint_plugin = __toESM(require("@typescript-eslint/eslint-plugin"), 1);
10032
+ var parserTs = __toESM(require("@typescript-eslint/parser"), 1);
10067
10033
  var import_eslint_plugin_antfu = __toESM(require("eslint-plugin-antfu"), 1);
10068
10034
  var import_eslint_plugin_eslint_comments = __toESM(require("eslint-plugin-eslint-comments"), 1);
10069
10035
  var pluginImport = __toESM(require("eslint-plugin-import-x"), 1);
@@ -10071,8 +10037,6 @@ var import_eslint_plugin_n = __toESM(require("eslint-plugin-n"), 1);
10071
10037
  var import_eslint_plugin_perfectionist = __toESM(require("eslint-plugin-perfectionist"), 1);
10072
10038
  var import_eslint_plugin_unicorn = __toESM(require("eslint-plugin-unicorn"), 1);
10073
10039
  var import_eslint_plugin_unused_imports = __toESM(require("eslint-plugin-unused-imports"), 1);
10074
- var import_eslint_plugin = __toESM(require("@typescript-eslint/eslint-plugin"), 1);
10075
- var parserTs = __toESM(require("@typescript-eslint/parser"), 1);
10076
10040
  async function importPluginReact() {
10077
10041
  const pluginReact = await interopDefault2(import("eslint-plugin-react"));
10078
10042
  return {
@@ -10237,7 +10201,7 @@ var imports = async (options) => {
10237
10201
  "import/no-named-default": "error",
10238
10202
  "import/no-self-import": "error",
10239
10203
  "import/no-webpack-loader-syntax": "error",
10240
- "import/order": "error",
10204
+ "import/order": "off",
10241
10205
  ...stylistic2 ? {
10242
10206
  "import/newline-after-import": [
10243
10207
  "error",
@@ -11198,6 +11162,39 @@ var perfectionist = async () => {
11198
11162
  plugins: {
11199
11163
  // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
11200
11164
  perfectionist: import_eslint_plugin_perfectionist.default
11165
+ },
11166
+ rules: {
11167
+ "perfectionist/sort-exports": [
11168
+ "error",
11169
+ { order: "asc", type: "natural" }
11170
+ ],
11171
+ "perfectionist/sort-imports": [
11172
+ "error",
11173
+ {
11174
+ groups: [
11175
+ "type",
11176
+ "builtin",
11177
+ "external",
11178
+ "internal-type",
11179
+ "internal",
11180
+ ["parent-type", "sibling-type", "index-type"],
11181
+ ["parent", "sibling", "index"],
11182
+ "object",
11183
+ "unknown"
11184
+ ],
11185
+ newlinesBetween: "ignore",
11186
+ order: "asc",
11187
+ type: "natural"
11188
+ }
11189
+ ],
11190
+ "perfectionist/sort-named-exports": [
11191
+ "error",
11192
+ { order: "asc", type: "natural" }
11193
+ ],
11194
+ "perfectionist/sort-named-imports": [
11195
+ "error",
11196
+ { order: "asc", type: "natural" }
11197
+ ]
11201
11198
  }
11202
11199
  }
11203
11200
  ];
@@ -11705,10 +11702,13 @@ var sortPackageJson = async () => {
11705
11702
  };
11706
11703
 
11707
11704
  // src/configs/sort-tsconfig.ts
11708
- var sortTsconfig = async () => {
11705
+ var tsconfigGlobs = (extendGlobs) => {
11706
+ return extendGlobs === void 0 || extendGlobs.length === 0 ? GLOB_TSCONFIG : uniqueStrings(GLOB_TSCONFIG, extendGlobs);
11707
+ };
11708
+ var sortTsconfig = async (options) => {
11709
11709
  return [
11710
11710
  {
11711
- files: ["**/tsconfig.json", "**/tsconfig.*.json"],
11711
+ files: tsconfigGlobs(options?.extendTsconfigGlobs),
11712
11712
  name: "jsse/sort/tsconfig",
11713
11713
  rules: {
11714
11714
  "jsonc/sort-keys": [
@@ -12117,7 +12117,6 @@ function unicornOff() {
12117
12117
  return {
12118
12118
  "unicorn/catch-error-name": "off",
12119
12119
  "unicorn/consistent-destructuring": "off",
12120
- // "unicorn/no-array-for-each": "off",
12121
12120
  "unicorn/no-array-reduce": "off",
12122
12121
  "unicorn/no-nested-ternary": "off",
12123
12122
  // conflicts with prettier
@@ -12231,7 +12230,7 @@ var unicorn = async () => {
12231
12230
  // src/configs/vitest.ts
12232
12231
  var vitest = async (options = {}) => {
12233
12232
  const { overrides = {} } = options;
12234
- const pluginVitest = await interopDefault2(import("eslint-plugin-vitest"));
12233
+ const pluginVitest = await interopDefault2(import("@vitest/eslint-plugin"));
12235
12234
  return [
12236
12235
  {
12237
12236
  name: "jsse/vitest/setup",
@@ -12310,6 +12309,86 @@ var yml = async (options) => {
12310
12309
  ];
12311
12310
  };
12312
12311
 
12312
+ // src/lager.ts
12313
+ var levels = {
12314
+ trace: 10,
12315
+ debug: 20,
12316
+ info: 30,
12317
+ warn: 40,
12318
+ error: 50,
12319
+ fatal: 60
12320
+ };
12321
+ function isLagerLevel(level) {
12322
+ return level === "trace" || level === "debug" || level === "info" || level === "warn" || level === "error" || level === "fatal";
12323
+ }
12324
+ var Lager = class {
12325
+ _level = "info";
12326
+ id = "lager";
12327
+ levelNo = levels[this._level];
12328
+ prefix = "";
12329
+ constructor(options) {
12330
+ const { level, id, prefix } = {
12331
+ level: "info",
12332
+ id: "lager",
12333
+ prefix: "@jsse/eslint-config",
12334
+ ...options
12335
+ };
12336
+ this.id = id;
12337
+ this._level = isLagerLevel(level) ? level : "info";
12338
+ this.levelNo = levels[this._level];
12339
+ this.prefix = prefix;
12340
+ this.log = this.log.bind(this);
12341
+ this.debug = this.debug.bind(this);
12342
+ }
12343
+ get level() {
12344
+ return this._level;
12345
+ }
12346
+ set level(level) {
12347
+ this._level = level;
12348
+ this.levelNo = levels[level];
12349
+ }
12350
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
12351
+ log(...args) {
12352
+ console.log(...args);
12353
+ }
12354
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
12355
+ trace(...args) {
12356
+ if (this.levelNo > levels.trace) {
12357
+ return;
12358
+ }
12359
+ console.trace(...args);
12360
+ }
12361
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
12362
+ debug(...args) {
12363
+ if (this.levelNo > levels.debug) {
12364
+ return;
12365
+ }
12366
+ console.debug(...args);
12367
+ }
12368
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
12369
+ info(...args) {
12370
+ if (this.levelNo > levels.info) {
12371
+ return;
12372
+ }
12373
+ console.info("[@jsse/eslint-config]", ...args);
12374
+ }
12375
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
12376
+ warn(...args) {
12377
+ if (this.levelNo > levels.warn) {
12378
+ return;
12379
+ }
12380
+ console.warn(...args);
12381
+ }
12382
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
12383
+ error(...args) {
12384
+ if (this.levelNo > levels.error) {
12385
+ return;
12386
+ }
12387
+ console.error(...args);
12388
+ }
12389
+ };
12390
+ var log = new Lager();
12391
+
12313
12392
  // src/slow.ts
12314
12393
  var slowRules = [
12315
12394
  "@typescript-eslint/no-misused-promises",
@@ -12491,7 +12570,9 @@ async function jsse(options = {}, ...userConfigs) {
12491
12570
  stylistic: stylisticOptions
12492
12571
  }),
12493
12572
  sortPackageJson(),
12494
- sortTsconfig()
12573
+ sortTsconfig({
12574
+ extendTsconfigGlobs: normalizedOptions.extendTsconfigLintGlobs
12575
+ })
12495
12576
  );
12496
12577
  }
12497
12578
  if (normalizedOptions.tailwind) {
@@ -12607,6 +12688,7 @@ function jsseReact() {
12607
12688
  GLOB_ALL_SRC,
12608
12689
  GLOB_CSS,
12609
12690
  GLOB_EXCLUDE,
12691
+ GLOB_GRAPHQL,
12610
12692
  GLOB_HTML,
12611
12693
  GLOB_JS,
12612
12694
  GLOB_JSON,
@@ -12624,6 +12706,7 @@ function jsseReact() {
12624
12706
  GLOB_TESTS,
12625
12707
  GLOB_TOML,
12626
12708
  GLOB_TS,
12709
+ GLOB_TSCONFIG,
12627
12710
  GLOB_TSX,
12628
12711
  GLOB_YAML,
12629
12712
  combine,
@@ -12656,5 +12739,6 @@ function jsseReact() {
12656
12739
  pluginTs,
12657
12740
  pluginUnicorn,
12658
12741
  pluginUnusedImports,
12659
- renameRules
12742
+ renameRules,
12743
+ uniqueStrings
12660
12744
  });