@jsse/eslint-config 0.2.25 → 0.2.26

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/CHANGELOG.md ADDED
@@ -0,0 +1,189 @@
1
+ # @jsse/eslint-config
2
+
3
+ ## 0.2.26
4
+
5
+ ### Patch Changes
6
+
7
+ - Added eslint-plugin-command
8
+
9
+ ## 0.2.25
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies
14
+
15
+ ## 0.2.24
16
+
17
+ ### Patch Changes
18
+
19
+ - 6857d07: upgraded dependencies including react-hooks
20
+ - No include sourcemaps
21
+
22
+ ## 0.2.23
23
+
24
+ ### Patch Changes
25
+
26
+ - updated dependencies
27
+
28
+ ## 0.2.22
29
+
30
+ ### Patch Changes
31
+
32
+ - a45fba1: upgraded dependencies including react-hooks
33
+
34
+ ## 0.2.21
35
+
36
+ ### Patch Changes
37
+
38
+ - add70d7: added functions to change rule level(s) from warn2error/error2warn
39
+ - add70d7: switched to @eslint-community/eslint-plugin-eslint-comments
40
+ - 75fa7d2: turned off top level functions because they can be super annoying.
41
+
42
+ ## 0.2.20
43
+
44
+ ### Patch Changes
45
+
46
+ - fix markdown plugins
47
+
48
+ ## 0.2.19
49
+
50
+ ### Patch Changes
51
+
52
+ - f2ccede: turn off unicorn/no-null for jsx/tsx
53
+
54
+ ## 0.2.18
55
+
56
+ ### Patch Changes
57
+
58
+ - Turn `no-console` back to only warn/error defaults
59
+
60
+ ## 0.2.17
61
+
62
+ ### Patch Changes
63
+
64
+ - Added eslint compat so that react hooks plugin works again
65
+
66
+ ## 0.2.16
67
+
68
+ ### Patch Changes
69
+
70
+ - disable builtin sort-imports
71
+
72
+ ## 0.2.15
73
+
74
+ ### Patch Changes
75
+
76
+ - Added `@/**` to sort imports internal patterns so now is `~/**' and '@/**'
77
+
78
+ ## 0.2.14
79
+
80
+ ### Patch Changes
81
+
82
+ - bump bc it is friday and the patch number is 13
83
+
84
+ ## 0.2.13
85
+
86
+ ### Patch Changes
87
+
88
+ - fix react first sorting globs
89
+
90
+ ## 0.2.12
91
+
92
+ ### Patch Changes
93
+
94
+ - put react/react-\* first in sort imports
95
+
96
+ ## 0.2.11
97
+
98
+ ### Patch Changes
99
+
100
+ - 59a8466: Switch from eslint-plugin-vitest to @vitest/eslint-plugin
101
+
102
+ ## 0.2.10
103
+
104
+ ### Patch Changes
105
+
106
+ - remove 'tailwind' package from deps bc it is 'tailwindcss'
107
+
108
+ ## 0.2.9
109
+
110
+ ### Patch Changes
111
+
112
+ - update dependencies
113
+
114
+ ## 0.2.8
115
+
116
+ ### Patch Changes
117
+
118
+ - 2c07b4d: Updated several dependencies
119
+
120
+ ## 0.2.6
121
+
122
+ ### Patch Changes
123
+
124
+ - 6135c20: allow bit-wise bc I am no pleb
125
+
126
+ ## 0.2.5
127
+
128
+ ### Patch Changes
129
+
130
+ - version deps update
131
+
132
+ ## 0.2.4
133
+
134
+ ### Patch Changes
135
+
136
+ - update to require unused imports 4.1.2
137
+
138
+ ## 0.2.3
139
+
140
+ ### Patch Changes
141
+
142
+ - 9320f02: fix project-service/classic-project usage w respect to eslint+ts
143
+ - 403d43f: no optional dependencies and moved them to dev deps
144
+
145
+ ## 0.2.1
146
+
147
+ ### Patch Changes
148
+
149
+ - Fixed ts-parser configuration for type-aware and non-type aware lints... used
150
+ antfu as reference
151
+
152
+ ## 0.2.0
153
+
154
+ ### Minor Changes
155
+
156
+ - 01c5361: updated deps to eslint-9 version(s)
157
+
158
+ ## 0.1.22
159
+
160
+ ### Patch Changes
161
+
162
+ - 024117f: dependencies updated
163
+ - db0373f: updated strictness of tsconfig and added biome as a test to dev deps
164
+ - f19feb1: ignore dependabot updates for several versions
165
+
166
+ ## 0.1.21
167
+
168
+ ### Patch Changes
169
+
170
+ - Actually fix the tailwind dep problem this time
171
+
172
+ ## 0.1.20
173
+
174
+ ### Patch Changes
175
+
176
+ - updated deps and fixed tailwind deps
177
+
178
+ ## 0.1.19
179
+
180
+ ### Patch Changes
181
+
182
+ - 658eae8: downgrade eslint-plugin-unused-imports
183
+
184
+ ## 0.1.18
185
+
186
+ ### Patch Changes
187
+
188
+ - f0f7337: Changed name separator to follow typescript-eslint as they know what
189
+ they're doing
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2023-PRESENT Jesse K Rubin <https://github.com/jessekrubin>
3
+ Copyright (c) 2023-2024 Jesse K Rubin <https://github.com/jessekrubin>
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
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.25";
615
+ var version = "0.2.26";
616
616
 
617
617
  // src/cli.ts
618
618
  var cli = cac("jsselint");
@@ -666,6 +666,10 @@ export default jsse(
666
666
  ${CONFIG_OPTIONS_STRING}
667
667
  );
668
668
  `;
669
+ cli.command("", "default command").action(() => {
670
+ cli.outputHelp();
671
+ import_node_process.default.exit(1);
672
+ });
669
673
  cli.command("init", "create eslint config file").option("--force", "force create eslint config file").action(async (options) => {
670
674
  console.log("init");
671
675
  const configPath = "eslint.config.js";
@@ -691,10 +695,29 @@ cli.command("init", "create eslint config file").option("--force", "force create
691
695
  import_node_fs.default.writeFileSync(configPath, eslintConfigString.join("\n"));
692
696
  console.log(`made eslint.config.js (type: ${packageJson.type})`);
693
697
  });
698
+ cli.command("version", "echo version").action(() => {
699
+ console.log(version);
700
+ });
694
701
  cli.version(typeof version === "string" ? version : "unknown");
695
702
  cli.help();
696
- var r = cli.parse();
697
- if (JSON.stringify(r) === JSON.stringify({ args: [], options: { "--": [] } })) {
698
- cli.outputHelp();
699
- import_node_process.default.exit(1);
703
+ async function main(args) {
704
+ const argv = args ?? import_node_process.default.argv.slice(2);
705
+ try {
706
+ const parsed = cli.parse(argv, { run: false });
707
+ console.log("=====");
708
+ console.log(parsed);
709
+ console.log("=====");
710
+ await cli.runMatchedCommand();
711
+ } catch (error) {
712
+ if (error instanceof Error) {
713
+ console.error("Error: %s\n\n%s", error.message, error.stack);
714
+ } else {
715
+ console.error(error);
716
+ }
717
+ import_node_process.default.exit(1);
718
+ }
700
719
  }
720
+ main().catch((e) => {
721
+ console.error(e);
722
+ throw e;
723
+ });
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.25";
591
+ var version = "0.2.26";
592
592
 
593
593
  // src/cli.ts
594
594
  var cli = cac("jsselint");
@@ -642,6 +642,10 @@ export default jsse(
642
642
  ${CONFIG_OPTIONS_STRING}
643
643
  );
644
644
  `;
645
+ cli.command("", "default command").action(() => {
646
+ cli.outputHelp();
647
+ process2.exit(1);
648
+ });
645
649
  cli.command("init", "create eslint config file").option("--force", "force create eslint config file").action(async (options) => {
646
650
  console.log("init");
647
651
  const configPath = "eslint.config.js";
@@ -667,10 +671,29 @@ cli.command("init", "create eslint config file").option("--force", "force create
667
671
  fs.writeFileSync(configPath, eslintConfigString.join("\n"));
668
672
  console.log(`made eslint.config.js (type: ${packageJson.type})`);
669
673
  });
674
+ cli.command("version", "echo version").action(() => {
675
+ console.log(version);
676
+ });
670
677
  cli.version(typeof version === "string" ? version : "unknown");
671
678
  cli.help();
672
- var r = cli.parse();
673
- if (JSON.stringify(r) === JSON.stringify({ args: [], options: { "--": [] } })) {
674
- cli.outputHelp();
675
- process2.exit(1);
679
+ async function main(args) {
680
+ const argv = args ?? process2.argv.slice(2);
681
+ try {
682
+ const parsed = cli.parse(argv, { run: false });
683
+ console.log("=====");
684
+ console.log(parsed);
685
+ console.log("=====");
686
+ await cli.runMatchedCommand();
687
+ } catch (error) {
688
+ if (error instanceof Error) {
689
+ console.error("Error: %s\n\n%s", error.message, error.stack);
690
+ } else {
691
+ console.error(error);
692
+ }
693
+ process2.exit(1);
694
+ }
676
695
  }
696
+ main().catch((e) => {
697
+ console.error(e);
698
+ throw e;
699
+ });
package/dist/esm/cli.js CHANGED
@@ -54,6 +54,11 @@ export default jsse(
54
54
  ${CONFIG_OPTIONS_STRING}
55
55
  );
56
56
  `;
57
+ // DEFAULT COMMAND
58
+ cli.command("", "default command").action(() => {
59
+ cli.outputHelp();
60
+ process.exit(1);
61
+ });
57
62
  cli
58
63
  .command("init", "create eslint config file")
59
64
  .option("--force", "force create eslint config file")
@@ -86,10 +91,31 @@ cli
86
91
  fs.writeFileSync(configPath, eslintConfigString.join("\n"));
87
92
  console.log(`made eslint.config.js (type: ${packageJson.type})`);
88
93
  });
94
+ cli.command("version", "echo version").action(() => {
95
+ console.log(version);
96
+ });
89
97
  cli.version(typeof version === "string" ? version : "unknown");
90
98
  cli.help();
91
- const r = cli.parse();
92
- if (JSON.stringify(r) === JSON.stringify({ args: [], options: { "--": [] } })) {
93
- cli.outputHelp();
94
- process.exit(1);
99
+ async function main(args) {
100
+ const argv = args ?? process.argv.slice(2);
101
+ try {
102
+ const parsed = cli.parse(argv, { run: false });
103
+ console.log("=====");
104
+ console.log(parsed);
105
+ console.log("=====");
106
+ await cli.runMatchedCommand();
107
+ }
108
+ catch (error) {
109
+ if (error instanceof Error) {
110
+ console.error("Error: %s\n\n%s", error.message, error.stack);
111
+ }
112
+ else {
113
+ console.error(error);
114
+ }
115
+ process.exit(1);
116
+ }
95
117
  }
118
+ main().catch((e) => {
119
+ console.error(e);
120
+ throw e;
121
+ });
@@ -3,6 +3,7 @@ export declare function configFunctions(): {
3
3
  antfu: import("./types.js").EslintConfigFn<{
4
4
  topLevelFunction: "error" | "off";
5
5
  }>;
6
+ command: import("./types.js").EslintConfigFn;
6
7
  comments: import("./types.js").EslintConfigFn;
7
8
  ignores: import("./types.js").EslintConfigFn;
8
9
  imports: import("./types.js").EslintConfigFn<import("./types.js").OptionsStylistic>;
@@ -32,6 +33,7 @@ export declare function configFunctions(): {
32
33
  yml: import("./types.js").EslintConfigFn<import("./types.js").OptionsOverrides & import("./types.js").OptionsStylistic & import("./types.js").OptionsFiles>;
33
34
  };
34
35
  export { antfu } from "./configs/antfu.js";
36
+ export { command } from "./configs/command.js";
35
37
  export { comments } from "./configs/comments.js";
36
38
  export { ignores } from "./configs/ignores.js";
37
39
  export { imports } from "./configs/imports.js";
@@ -1,4 +1,5 @@
1
1
  import { antfu } from "./configs/antfu.js";
2
+ import { command } from "./configs/command.js";
2
3
  import { comments } from "./configs/comments.js";
3
4
  import { ignores } from "./configs/ignores.js";
4
5
  import { imports } from "./configs/imports.js";
@@ -23,8 +24,10 @@ import { vitest } from "./configs/vitest.js";
23
24
  import { yml } from "./configs/yml.js";
24
25
  // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
25
26
  export function configFunctions() {
27
+ // @keep-sorted
26
28
  return {
27
29
  antfu,
30
+ command,
28
31
  comments,
29
32
  ignores,
30
33
  imports,
@@ -51,6 +54,7 @@ export function configFunctions() {
51
54
  };
52
55
  }
53
56
  export { antfu } from "./configs/antfu.js";
57
+ export { command } from "./configs/command.js";
54
58
  export { comments } from "./configs/comments.js";
55
59
  export { ignores } from "./configs/ignores.js";
56
60
  export { imports } from "./configs/imports.js";
@@ -0,0 +1,10 @@
1
+ import type { EslintConfigFn } from "../types.js";
2
+ /**
3
+ * Config for `eslint-plugin-command`
4
+ *
5
+ * Repo: https://github.com/antfu/eslint-plugin-command
6
+ * Docs: https://eslint-plugin-command.antfu.me/guide/
7
+ *
8
+ * @returns Typed config arr
9
+ */
10
+ export declare const command: EslintConfigFn;
@@ -0,0 +1,17 @@
1
+ import createCommand from "eslint-plugin-command/config";
2
+ /**
3
+ * Config for `eslint-plugin-command`
4
+ *
5
+ * Repo: https://github.com/antfu/eslint-plugin-command
6
+ * Docs: https://eslint-plugin-command.antfu.me/guide/
7
+ *
8
+ * @returns Typed config arr
9
+ */
10
+ export const command = async () => {
11
+ return [
12
+ {
13
+ ...createCommand(),
14
+ name: "jsse/command/rules",
15
+ },
16
+ ];
17
+ };
@@ -1,6 +1,5 @@
1
1
  import { uniqueStrings } from "src/utils.js";
2
2
  import { GLOB_TSCONFIG } from "../globs.js";
3
- // eslint-disable-next-line antfu/top-level-function
4
3
  const tsconfigGlobs = (extendGlobs) => {
5
4
  return extendGlobs === undefined || extendGlobs.length === 0
6
5
  ? GLOB_TSCONFIG
@@ -1,5 +1,5 @@
1
1
  import { GLOB_SRC } from "../globs.js";
2
- import { log } from "../lager.js";
2
+ import { log } from "../log.js";
3
3
  import { safeImportPluginTailwind } from "../plugins.js";
4
4
  const TAILWIND_ESLINT_SETTINGS_DEFAULT = {
5
5
  // These are the default values but feel free to customize
package/dist/esm/const.js CHANGED
@@ -1,11 +1,26 @@
1
1
  /**
2
2
  * CONSTANTS LISTS AND REFERENCES OH MY!
3
3
  */
4
+ // @keep-sorted
4
5
  export const SLOW_RULES = [
5
6
  "@typescript-eslint/no-misused-promises",
7
+ "@typescript-eslint/no-redeclare",
6
8
  "@typescript-eslint/no-unsafe-assignment",
7
9
  "@typescript-eslint/no-unsafe-call",
8
10
  "@typescript-eslint/no-unsafe-member-access",
9
11
  "@typescript-eslint/no-unsafe-return",
12
+ "import/no-duplicates",
13
+ "import/no-self-import",
14
+ "jsdoc/check-access",
15
+ "jsdoc/check-alignment",
16
+ "jsdoc/check-property-names",
17
+ "jsdoc/check-types",
18
+ "jsdoc/empty-tags",
19
+ "jsdoc/multiline-blocks",
20
+ "jsdoc/no-multi-asterisks",
21
+ "jsdoc/require-property-description",
22
+ "jsdoc/require-property-name",
23
+ "jsdoc/require-property",
24
+ "unicorn/expiring-todo-comments",
10
25
  "unicorn/no-unnecessary-polyfills",
11
26
  ];
@@ -1,9 +1,9 @@
1
1
  import fs from "node:fs";
2
2
  import process from "node:process";
3
3
  import { isPackageExists } from "local-pkg";
4
- import { antfu, comments, ignores, imports, javascript, jsdoc, jsonc, markdown, n, noOnlyTests, perfectionist, prettier, react, sortPackageJson, sortTsconfig, stylistic, tailwind, tsdoc, typescript, unicorn, vitest, yml, } from "./config-fns.js";
4
+ import { antfu, command, comments, ignores, imports, javascript, jsdoc, jsonc, markdown, n, noOnlyTests, perfectionist, prettier, react, sortPackageJson, sortTsconfig, stylistic, tailwind, tsdoc, typescript, unicorn, vitest, yml, } from "./config-fns.js";
5
5
  import { SLOW_RULES } from "./const.js";
6
- import { log } from "./lager.js";
6
+ import { log } from "./log.js";
7
7
  import { combineAsync, interopDefault, isInEditor, turnOffRules, } from "./utils.js";
8
8
  const flatConfigProps = [
9
9
  "files",
@@ -18,6 +18,7 @@ const flatConfigProps = [
18
18
  const DEBUG = ["1", "true", "t", "on", "yes", "y"].includes(process.env.DEBUG ?? "");
19
19
  function defaultOptions() {
20
20
  return {
21
+ command: true,
21
22
  componentExts: [],
22
23
  debug: DEBUG && process.env.TEST !== "true",
23
24
  fast: false,
@@ -66,7 +67,7 @@ function normalizeOptions(options = {}) {
66
67
  export async function jsse(options = {}, ...userConfigs) {
67
68
  const normalizedOptions = normalizeOptions(options);
68
69
  const { componentExts, debug, gitignore: enableGitignore, isInEditor, off, overrides = {}, prettier: enablePrettier, react: enableReact, reportUnusedDisableDirectives, stylistic: stylisticOptions, tsPrefix, typeAware, typescript: enableTypeScript, } = normalizedOptions;
69
- if (debug) {
70
+ if (debug || process.argv.includes("--debug")) {
70
71
  log.level = "debug";
71
72
  }
72
73
  log.debug("@jsse/eslint-config debug=true");
@@ -104,6 +105,9 @@ export async function jsse(options = {}, ...userConfigs) {
104
105
  }), comments(), n(), jsdoc(), imports({
105
106
  stylistic: stylisticOptions,
106
107
  }), unicorn(), antfu(), perfectionist());
108
+ if (normalizedOptions.command) {
109
+ configs.push(command());
110
+ }
107
111
  if (enableTypeScript) {
108
112
  const tscfg = typescript({
109
113
  ...(typeof enableTypeScript === "boolean" ? {} : enableTypeScript),
@@ -0,0 +1 @@
1
+ export declare const VERSION = "0.2.26";
@@ -0,0 +1 @@
1
+ export const VERSION = "0.2.26";
@@ -1,7 +1,8 @@
1
1
  export { SLOW_RULES } from "./const.js";
2
2
  export { defineConfig, jsse } from "./define-config.js";
3
3
  export { jsse as default } from "./define-config.js";
4
- export * from "./globs.js";
4
+ export { VERSION } from "./generated/version.js";
5
+ export * as globs from "./globs.js";
5
6
  export * from "./plugins.js";
6
7
  export { jsseReact } from "./presets.js";
7
8
  export * from "./types.js";
package/dist/esm/index.js CHANGED
@@ -1,7 +1,8 @@
1
1
  export { SLOW_RULES } from "./const.js";
2
2
  export { defineConfig, jsse } from "./define-config.js";
3
3
  export { jsse as default } from "./define-config.js";
4
- export * from "./globs.js";
4
+ export { VERSION } from "./generated/version.js";
5
+ export * as globs from "./globs.js";
5
6
  export * from "./plugins.js";
6
7
  export { jsseReact } from "./presets.js";
7
8
  export * from "./types.js";
@@ -27,5 +27,4 @@ export declare class Lager {
27
27
  warn(...args: any[]): void;
28
28
  error(...args: any[]): void;
29
29
  }
30
- export declare const log: Lager;
31
30
  export {};
package/dist/esm/lager.js CHANGED
@@ -83,4 +83,3 @@ export class Lager {
83
83
  }
84
84
  }
85
85
  }
86
- export const log = new Lager();
@@ -0,0 +1,2 @@
1
+ import { Lager } from "./lager.js";
2
+ export declare const log: Lager;
@@ -0,0 +1,2 @@
1
+ import { Lager } from "./lager.js";
2
+ export const log = new Lager();
@@ -146,6 +146,12 @@ export type OptionsConfig = {
146
146
  * Array of rules to turn off.
147
147
  */
148
148
  off?: string[];
149
+ /**
150
+ * Enable `eslint-plugin-command`
151
+ *
152
+ * @default true
153
+ */
154
+ command?: boolean;
149
155
  /**
150
156
  * Enable fast mode.
151
157
  *
package/dist/esm/utils.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import process from "node:process";
2
- import { log } from "./lager.js";
2
+ import { log } from "./log.js";
3
3
  /**
4
4
  * Combine array and non-array configs into a single array.
5
5
  */