@the-stranger/eslint-plugin 2.1.0 → 2.1.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@the-stranger/eslint-plugin",
3
- "version": "2.1.0",
3
+ "version": "2.1.2",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/the-chris-strange/the-stranger.git",
@@ -22,31 +22,28 @@
22
22
  "module": "./src/index.js",
23
23
  "types": "./src/types.d.ts",
24
24
  "dependencies": {
25
- "@the-stranger/eslint-config": "^1.0.0",
26
- "@the-stranger/eslint-utils": "^1.0.0",
27
- "tslib": "^2.8.1"
25
+ "@the-stranger/eslint-config": "^1.2.0",
26
+ "@the-stranger/eslint-utils": "^1.1.0",
27
+ "tslib": "^2.8.1",
28
+ "typescript-eslint": "^8.58.2"
28
29
  },
29
30
  "devDependencies": {
30
- "@nx/eslint": "22.5.2",
31
- "@nx/eslint-plugin": "22.5.2",
32
- "@nx/vitest": "22.5.2",
33
- "@types/eslint-plugin-jsx-a11y": "^6.10.1",
34
31
  "@types/node": "^24.12.2",
35
- "@typescript-eslint/parser": "^8.58.2",
36
32
  "@vitest/coverage-v8": "4.1.4",
37
33
  "eslint": "^9.39.4",
38
- "eslint-config-prettier": "^10.1.8",
39
34
  "eslint-plugin-eslint-plugin": "^7.3.2",
40
- "nx": "22.5.2",
41
- "prettier": "^3.8.3",
42
- "prettier-plugin-packagejson": "^3.0.2",
35
+ "jsonc-eslint-parser": "^3.1.0",
43
36
  "typescript": "^5.9.3",
44
- "vite": "7.3.2",
45
37
  "vitest": "4.1.4"
46
38
  },
47
39
  "peerDependencies": {
48
- "eslint": "^9",
49
- "typescript-eslint": "^8"
40
+ "@nx/eslint-plugin": ">=21 <23",
41
+ "eslint": "^9"
42
+ },
43
+ "peerDependenciesMeta": {
44
+ "@nx/eslint-plugin": {
45
+ "optional": true
46
+ }
50
47
  },
51
48
  "engines": {
52
49
  "node": "^24"
@@ -1,7 +1,7 @@
1
1
  export declare const configs: {
2
2
  readonly disableTypeChecked: {
3
3
  name: string;
4
- rules: {};
4
+ rules: object | undefined;
5
5
  }[];
6
6
  readonly json: import("eslint/config").Config[];
7
7
  readonly recommended: import("eslint/config").Config[];
@@ -1,16 +1,27 @@
1
- import { configure } from '@the-stranger/eslint-config';
1
+ import { configure, } from '@the-stranger/eslint-config';
2
2
  import { disableTypeCheckedConfig } from './disable-type-checked.js';
3
3
  import { disableExcept } from './utils/options.js';
4
4
  const recommendedSourceOptions = {
5
5
  agentSkills: true,
6
- js: true,
6
+ js: {
7
+ browser: true,
8
+ node: true,
9
+ },
7
10
  jsdoc: true,
8
11
  node: true,
9
12
  promise: true,
10
- react: false,
13
+ react: {
14
+ astro: false,
15
+ typeChecked: false,
16
+ typescript: false,
17
+ },
11
18
  regexp: true,
12
19
  sort: true,
13
- ts: { strict: false, typeChecked: true },
20
+ ts: {
21
+ strict: false,
22
+ typeChecked: true,
23
+ typescript: true,
24
+ },
14
25
  unicorn: true,
15
26
  };
16
27
  const recommendedReactOptions = {
@@ -1,4 +1,4 @@
1
1
  export declare const disableTypeCheckedConfig: {
2
2
  name: string;
3
- rules: {};
3
+ rules: object | undefined;
4
4
  }[];
@@ -1,8 +1,8 @@
1
+ import { namer } from '@the-stranger/eslint-utils';
1
2
  import tseslint from 'typescript-eslint';
2
- import { namer } from './namer.js';
3
3
  export const disableTypeCheckedConfig = [
4
4
  {
5
5
  name: namer('disable-type-checked'),
6
- rules: { ...tseslint.configs.disableTypeChecked.rules },
6
+ rules: tseslint.configs.disableTypeChecked.rules,
7
7
  },
8
8
  ];
@@ -30,7 +30,7 @@ export class ImportResolver {
30
30
  try {
31
31
  const pending = this.loadModule(specifier);
32
32
  this.cache.set(specifier, pending);
33
- return pending;
33
+ return await pending;
34
34
  }
35
35
  catch (error) {
36
36
  this.cache.delete(specifier);
@@ -72,7 +72,7 @@ export class ImportResolver {
72
72
  * @returns the target, or undefined if the message doesn't match the expected pattern
73
73
  */
74
74
  extractCannotFindModuleTarget(message) {
75
- const match = message.match(/Cannot find module ['"]([^'"]+)['"]/i);
75
+ const match = /Cannot find module ['"]([^'"]+)['"]/i.exec(message);
76
76
  return match?.[1];
77
77
  }
78
78
  /**
@@ -83,7 +83,7 @@ export class ImportResolver {
83
83
  * @returns the target, or undefined if the message doesn't match the expected pattern
84
84
  */
85
85
  extractQuotedMissingTarget(message) {
86
- const match = message.match(/Cannot find (?:package|module) ['"]([^'"]+)['"]/i);
86
+ const match = /Cannot find (?:package|module) ['"]([^'"]+)['"]/i.exec(message);
87
87
  return match?.[1];
88
88
  }
89
89
  /**
package/src/utils.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export { configure, type ConfigOptions } from '@the-stranger/eslint-config';
1
+ export { configure, type ConfigOptions, type Options, } from '@the-stranger/eslint-config';
2
2
  export { FilePatterns, getFilePatterns, setSeverity } from '@the-stranger/eslint-utils';
package/src/utils.js CHANGED
@@ -1,2 +1,2 @@
1
- export { configure } from '@the-stranger/eslint-config';
1
+ export { configure, } from '@the-stranger/eslint-config';
2
2
  export { FilePatterns, getFilePatterns, setSeverity } from '@the-stranger/eslint-utils';
@@ -1,26 +0,0 @@
1
- import type { Linter } from 'eslint';
2
- /**
3
- * Prepend the workspace's namespace or full name to a string. Useful for naming eslint configuration objects.
4
- * @internal
5
- * @param value the value to add to the name
6
- * @returns prefixed value
7
- */
8
- export declare function namer(value?: string): string;
9
- /**
10
- * Set the `name` property of an ESLint config.
11
- * @internal
12
- * @param config the object
13
- * @param defaultName override the default behavior of this function
14
- * @returns the named config(s)
15
- */
16
- export declare function objectNamer(config: Config, defaultName?: string): Named<Config>;
17
- /**
18
- * Make the name property of an object required. Preserves JSDoc comments for objects that already have a name property.
19
- * @internal
20
- */
21
- export type Named<T extends object> = Required<T extends N ? Pick<T, 'name'> : N> & T;
22
- type Config = Linter.Config;
23
- type N = {
24
- name?: string;
25
- };
26
- export {};
package/src/lib/namer.js DELETED
@@ -1,38 +0,0 @@
1
- import pkg from '../../package.json' with { type: 'json' };
2
- /**
3
- * Prepend the workspace's namespace or full name to a string. Useful for naming eslint configuration objects.
4
- * @internal
5
- * @param value the value to add to the name
6
- * @returns prefixed value
7
- */
8
- export function namer(value) {
9
- const ws = /@[a-z-]+\/.+/i.exec(pkg.name)?.[0] ?? pkg.name;
10
- if (value) {
11
- return value.startsWith(ws) ? value : `${ws}/${value}`;
12
- }
13
- return ws;
14
- }
15
- /**
16
- * Set the `name` property of an ESLint config.
17
- * @internal
18
- * @param config the object
19
- * @param defaultName override the default behavior of this function
20
- * @returns the named config(s)
21
- */
22
- export function objectNamer(config, defaultName) {
23
- if (defaultName) {
24
- return { ...config, name: defaultName };
25
- }
26
- else if (config.name) {
27
- return config;
28
- }
29
- else if (config.plugins) {
30
- const plugins = Object.keys(config.plugins);
31
- return { ...config, name: namer(plugins[0]) };
32
- }
33
- else {
34
- const rules = Object.keys(config.rules ?? {}).map(e => e.split('/')[0]);
35
- const name = [...new Set(rules)].join('/');
36
- return { ...config, name };
37
- }
38
- }