@darksheep/eslint 6.1.1 → 6.2.0

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": "@darksheep/eslint",
3
- "version": "6.1.1",
3
+ "version": "6.2.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/DarkSheepSoftware/eslint"
@@ -18,23 +18,25 @@
18
18
  "types"
19
19
  ],
20
20
  "scripts": {
21
- "githooks": "git config core.hooksPath .githooks"
21
+ "githooks": "git config core.hooksPath .githooks",
22
+ "prepack": "tsc"
22
23
  },
23
24
  "dependencies": {
24
25
  "@eslint-community/eslint-plugin-eslint-comments": "4.4.0",
25
- "@eslint/eslintrc": "3.1.0",
26
- "@eslint/js": "9.9.1",
27
- "@stylistic/eslint-plugin": "2.7.2",
28
- "@typescript-eslint/eslint-plugin": "8.4.0",
29
- "@typescript-eslint/parser": "8.4.0",
26
+ "@eslint/js": "9.10.0",
27
+ "@stylistic/eslint-plugin": "2.8.0",
28
+ "@types/estree": "1.0.5",
29
+ "@types/json-schema": "7.0.15",
30
+ "@typescript-eslint/eslint-plugin": "8.5.0",
31
+ "@typescript-eslint/parser": "8.5.0",
30
32
  "editorconfig": "2.0.0",
31
33
  "eslint-plugin-jsdoc": "50.2.2",
32
34
  "eslint-plugin-jsonc": "2.16.0",
33
35
  "eslint-plugin-n": "17.10.2",
34
36
  "eslint-plugin-package-json": "0.15.2",
35
- "eslint-plugin-perfectionist": "3.3.0",
37
+ "eslint-plugin-perfectionist": "3.5.0",
36
38
  "eslint-plugin-promise": "7.1.0",
37
- "eslint-plugin-react": "7.35.1",
39
+ "eslint-plugin-react": "7.35.2",
38
40
  "eslint-plugin-regexp": "2.6.0",
39
41
  "eslint-plugin-security": "3.0.1",
40
42
  "eslint-plugin-unicorn": "55.0.0",
@@ -45,17 +47,13 @@
45
47
  },
46
48
  "devDependencies": {
47
49
  "@darksheep/eslint-formatter-github": "2.0.1",
48
- "@types/eslint": "~9.6.0",
49
- "@types/eslint__eslintrc": "~2.1.1",
50
- "@types/eslint__js": "~8.42.3",
51
- "@types/estree": "~1.0.2",
52
50
  "@types/node": "~20.16.0",
53
- "eslint": "~9.9.0",
51
+ "eslint": "~9.10.0",
54
52
  "type-fest": "~4.26.0",
55
- "typescript": "~5.5.0"
53
+ "typescript": "~5.6.0"
56
54
  },
57
55
  "peerDependencies": {
58
- "eslint": "~9.9.0"
56
+ "eslint": "~9.10.0"
59
57
  },
60
58
  "peerDependenciesMeta": {
61
59
  "typescript": {
@@ -4,10 +4,14 @@
4
4
  */
5
5
  const preferInstance = (context) => ({
6
6
  /**
7
- * @param {import('estree').CallExpression} node The AST function node
7
+ * @param {import('eslint').Rule.Node} node The AST function node
8
8
  * @returns {void}
9
9
  */
10
10
  'CallExpression[callee.object.name = "Array"][callee.property.name = "isArray"]': (node) => {
11
+ if (node.type !== 'CallExpression') {
12
+ return;
13
+ }
14
+
11
15
  const message = 'Use `instanceof Array` instead of `Array.isArray()`';
12
16
 
13
17
  if (node.arguments.length !== 1) {
@@ -28,10 +32,14 @@ const preferInstance = (context) => ({
28
32
  */
29
33
  const preferIsArray = (context) => ({
30
34
  /**
31
- * @param {import('estree').BinaryExpression} node The AST function node
35
+ * @param {import('eslint').Rule.Node} node The AST function node
32
36
  * @returns {void}
33
37
  */
34
38
  'BinaryExpression[operator="instanceof"][right.type="Identifier"][right.name="Array"]': (node) => {
39
+ if (node.type !== 'BinaryExpression') {
40
+ return;
41
+ }
42
+
35
43
  const message = 'Use `Array.isArray()` instead of `instanceof Array`';
36
44
 
37
45
  const argument = context.sourceCode.getText(node.left);
@@ -8,16 +8,7 @@ function createReporter(optionName, context, message) {
8
8
  const [ options ] = context.options;
9
9
 
10
10
  /**
11
- * @param {(
12
- * import('eslint').Rule.Node |
13
- * import('estree').Identifier |
14
- * import('estree').MemberExpression |
15
- * import('estree').ChainExpression |
16
- * import('estree').CallExpression |
17
- * import('estree').LogicalExpression |
18
- * import('estree').UnaryExpression
19
- * )} node The AST function node
20
- *
11
+ * @param {import('eslint').Rule.Node} node The AST function node
21
12
  * @returns {void}
22
13
  */
23
14
  function validateNode(node) {
@@ -12,7 +12,7 @@ const rule = {
12
12
  create: function (context) {
13
13
  return {
14
14
  /**
15
- * @param {import('estree').Literal} node The AST function node
15
+ * @param {import('eslint').Rule.Node} node The AST function node
16
16
  * @returns {void}
17
17
  */
18
18
  [selector]: (node) => {
@@ -5,7 +5,7 @@ const rule = {
5
5
  create: function (context) {
6
6
  return {
7
7
  /**
8
- * @param {import('estree').SequenceExpression} node The AST function node
8
+ * @param {import('eslint').Rule.Node} node The AST function node
9
9
  * @returns {void}
10
10
  */
11
11
  SequenceExpression: (node) => {
package/src/index.js CHANGED
@@ -47,7 +47,7 @@ const configBuilders = [
47
47
  ];
48
48
 
49
49
  /**
50
- * @param {URL} root The root url object for the project config
50
+ * @param {import('node:url').URL} root The root url object for the project config
51
51
  * @returns {Promise<import('eslint').Linter.FlatConfig[]>}
52
52
  */
53
53
  async function createConfigUrl(root) {
@@ -59,7 +59,7 @@ async function createConfigUrl(root) {
59
59
  }
60
60
 
61
61
  /**
62
- * @param {string | URL} root root url
62
+ * @param {string | import('node:url').URL} root root url
63
63
  * @returns {Promise<import('eslint').Linter.FlatConfig[]>}
64
64
  */
65
65
  export async function createConfig(root) {
@@ -79,5 +79,3 @@ export async function createConfig(root) {
79
79
 
80
80
  return createConfigUrl(pathToFileURL(root));
81
81
  }
82
-
83
- export * from 'eslint';
package/src/types.d.ts CHANGED
@@ -1,65 +1,25 @@
1
1
  /* eslint no-duplicate-imports: 0 */
2
2
 
3
- type WithRequired<T, K extends keyof T> = T & { [P in K]-?: T[P] };
4
-
5
- declare module '@eslint-community/eslint-plugin-eslint-comments' {
3
+ declare module '@eslint/js' {
6
4
  import type { ESLint } from 'eslint';
7
- export default {} as ESLint.Plugin;
8
- }
9
-
10
- declare module 'eslint-plugin-import' {
11
- import type { ESLint, Linter } from 'eslint';
12
- export default {} as {
5
+ export default {
13
6
  configs: {
14
- 'electron': {
15
- settings: Required<ESLint.ConfigData['settings']>;
16
- };
17
- 'errors': {
18
- plugins: Required<ESLint.ConfigData['plugins']>;
19
- rules: Linter.RulesRecord;
20
- };
21
- 'react': {
22
- parserOptions: Required<ESLint.ConfigData['parserOptions']>;
23
- settings: Required<ESLint.ConfigData['settings']>;
24
- };
25
- 'react-native': {
26
- settings: Required<ESLint.ConfigData['settings']>;
27
- };
28
- 'recommended': {
29
- parserOptions: Required<ESLint.ConfigData['parserOptions']>;
30
- plugins: Required<ESLint.ConfigData['plugins']>;
31
- rules: Linter.RulesRecord;
32
- };
33
- 'stage-0': {
34
- plugins: Required<ESLint.ConfigData['plugins']>;
35
- rules: Linter.RulesRecord;
36
- };
37
- 'typescript': {
38
- rules: Linter.RulesRecord;
39
- settings: Required<ESLint.ConfigData['settings']>;
40
- };
41
- 'warnings': {
42
- plugins: Required<ESLint.ConfigData['plugins']>;
43
- rules: Linter.RulesRecord;
44
- };
45
- };
46
- rules: Required<ESLint.Plugin['rules']>;
7
+ all: WithRequired<ESLint.ConfigData, 'rules'>,
8
+ recommended: WithRequired<ESLint.ConfigData, 'rules'>,
9
+ },
47
10
  };
48
11
  }
49
12
 
50
- declare module 'eslint-plugin-jest' {
51
- import type { ESLint } from 'eslint';
52
- export default {} as WithRequired<ESLint.Plugin, 'environments'>;
53
- }
13
+ type WithRequired<T, K extends keyof T> = T & { [P in K]-?: T[P] };
54
14
 
55
- declare module 'eslint-plugin-perfectionist' {
15
+ declare module '@eslint-community/eslint-plugin-eslint-comments' {
56
16
  import type { ESLint } from 'eslint';
57
- export default {} as WithRequired<ESLint.Plugin, 'environments'>;
17
+ export default {} as ESLint.Plugin;
58
18
  }
59
19
 
60
- declare module 'eslint-plugin-jsdoc' {
20
+ declare module 'eslint-plugin-perfectionist' {
61
21
  import type { ESLint } from 'eslint';
62
- export default {} as WithRequired<ESLint.Plugin, 'environments'>;
22
+ export default {} as ESLint.Plugin;
63
23
  }
64
24
 
65
25
  declare module '@stylistic/eslint-plugin' {
@@ -67,11 +27,6 @@ declare module '@stylistic/eslint-plugin' {
67
27
  export default {} as WithRequired<ESLint.Plugin, 'environments'>;
68
28
  }
69
29
 
70
- declare module 'eslint-plugin-jsx-a11y' {
71
- import type { ESLint } from 'eslint';
72
- export default {} as ESLint.Plugin;
73
- }
74
-
75
30
  declare module 'eslint-plugin-promise' {
76
31
  import type { ESLint } from 'eslint';
77
32
  export default {} as {
@@ -96,28 +51,3 @@ declare module 'eslint-plugin-security' {
96
51
  rules: Required<ESLint.Plugin['rules']>;
97
52
  };
98
53
  }
99
-
100
- declare module 'eslint-plugin-unused-imports' {
101
- import type { ESLint } from 'eslint';
102
- export default {} as ESLint.Plugin;
103
- }
104
-
105
- declare module 'eslint-plugin-n' {
106
- import type { ESLint, Linter } from 'eslint';
107
- export default {} as {
108
- configs: {
109
- 'flat/mixed-esm-and-cjs': Linter.FlatConfig;
110
- 'flat/recommended': Linter.FlatConfig;
111
- 'flat/recommended-module': Linter.FlatConfig;
112
- 'flat/recommended-script': Linter.FlatConfig;
113
- 'recommended': ESLint.ConfigData;
114
- 'recommended-module': ESLint.ConfigData;
115
- 'recommended-script': ESLint.ConfigData;
116
- };
117
- meta: {
118
- name: string;
119
- version: string;
120
- };
121
- rules: Required<ESLint.Plugin['rules']>;
122
- };
123
- }
@@ -1,7 +1,5 @@
1
1
  /**
2
- * @param {string | URL} root root url
2
+ * @param {string | import('node:url').URL} root root url
3
3
  * @returns {Promise<import('eslint').Linter.FlatConfig[]>}
4
4
  */
5
- export function createConfig(root: string | URL): Promise<import("eslint").Linter.FlatConfig[]>;
6
- export * from "eslint";
7
- import { URL } from 'node:url';
5
+ export function createConfig(root: string | import("node:url").URL): Promise<import("eslint").Linter.FlatConfig[]>;
@@ -4,44 +4,26 @@
4
4
  */
5
5
  export function createEditorOverrides(root: import("node:url").URL): Promise<import("eslint").Linter.FlatConfig[]>;
6
6
  export type RuleSet = {
7
- /**
8
- * end of line
9
- */
10
7
  /**
11
8
  * end of line
12
9
  */
13
10
  EOL: string;
14
- /**
15
- * line feed
16
- */
17
11
  /**
18
12
  * line feed
19
13
  */
20
14
  LF: string;
21
- /**
22
- * trailing spaces
23
- */
24
15
  /**
25
16
  * trailing spaces
26
17
  */
27
18
  TRAIL: string;
28
- /**
29
- * indent size
30
- */
31
19
  /**
32
20
  * indent size
33
21
  */
34
22
  INDENT: string;
35
- /**
36
- * indent binary ops size
37
- */
38
23
  /**
39
24
  * indent binary ops size
40
25
  */
41
26
  INDENT_BINARY?: string | undefined;
42
- /**
43
- * options to pass to the indent rule
44
- */
45
27
  /**
46
28
  * options to pass to the indent rule
47
29
  */
@@ -1,17 +0,0 @@
1
- import { resolve } from 'node:path';
2
- import { fileURLToPath } from 'node:url';
3
-
4
- import { FlatCompat } from '@eslint/eslintrc';
5
-
6
- /**
7
- * @param {import('node:url').URL} root root url
8
- * @returns {import('@eslint/eslintrc').FlatCompat}
9
- */
10
- export function makeCompat(root) {
11
- return new FlatCompat({
12
- // The root of the importing project
13
- baseDirectory: fileURLToPath(root),
14
- // The root of our project
15
- resolvePluginsRelativeTo: resolve(fileURLToPath(import.meta.url), '..', '..', '..'),
16
- });
17
- }
@@ -1,5 +0,0 @@
1
- /**
2
- * @param {import('node:url').URL} root root url
3
- * @returns {import('@eslint/eslintrc').FlatCompat}
4
- */
5
- export function makeCompat(root: import("node:url").URL): import("@eslint/eslintrc").FlatCompat;