@darksheep/eslint 7.0.3 โ†’ 8.0.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/CHANGELOG.md CHANGED
@@ -1,5 +1,50 @@
1
1
  # Changelog
2
2
 
3
+ ## [8.0.0](https://github.com/DarkSheepSoftware/eslint/compare/v7.0.4...v8.0.0) (2025-07-19)
4
+
5
+
6
+ ### โš  BREAKING CHANGES
7
+
8
+ * **pkg:** update dependency @stylistic/eslint-plugin to v5 ([#937](https://github.com/DarkSheepSoftware/eslint/issues/937))
9
+
10
+ ### ๐Ÿ“ฆ Dependencies
11
+
12
+ * **pkg:** update dependency @eslint/compat to v1.3.1 ([#943](https://github.com/DarkSheepSoftware/eslint/issues/943)) ([3ed5836](https://github.com/DarkSheepSoftware/eslint/commit/3ed5836c91757adddd97e13caa022275a6b80aef))
13
+ * **pkg:** update dependency @stylistic/eslint-plugin to v5 ([#937](https://github.com/DarkSheepSoftware/eslint/issues/937)) ([f6b7cf3](https://github.com/DarkSheepSoftware/eslint/commit/f6b7cf3308acae3bc2bfa25de72da854afa2fb00))
14
+ * **pkg:** update dependency editorconfig to v3.0.1 ([#954](https://github.com/DarkSheepSoftware/eslint/issues/954)) ([5f7a87d](https://github.com/DarkSheepSoftware/eslint/commit/5f7a87dc7a8d3baacb7bfce3bf5836427fcb042d))
15
+ * **pkg:** update dependency eslint-plugin-jsdoc to v51.2.3 ([#938](https://github.com/DarkSheepSoftware/eslint/issues/938)) ([6cbc878](https://github.com/DarkSheepSoftware/eslint/commit/6cbc87875c4c32bcb80dec76e5b48baac2001159))
16
+ * **pkg:** update dependency eslint-plugin-jsdoc to v51.3.1 ([#946](https://github.com/DarkSheepSoftware/eslint/issues/946)) ([949c67b](https://github.com/DarkSheepSoftware/eslint/commit/949c67b529383140dde4b8173d9a8a85bfe18495))
17
+ * **pkg:** update dependency eslint-plugin-jsdoc to v51.4.1 ([#952](https://github.com/DarkSheepSoftware/eslint/issues/952)) ([b566232](https://github.com/DarkSheepSoftware/eslint/commit/b56623212f3f8d0c6b2bb77e2e9168e991ba8a51))
18
+ * **pkg:** update dependency eslint-plugin-n to v17.21.0 ([#953](https://github.com/DarkSheepSoftware/eslint/issues/953)) ([a2b6518](https://github.com/DarkSheepSoftware/eslint/commit/a2b6518c60eadbd3b7cc91e00c97796da254f4db))
19
+ * **pkg:** update dependency eslint-plugin-package-json to v0.42.0 ([#939](https://github.com/DarkSheepSoftware/eslint/issues/939)) ([c7e1459](https://github.com/DarkSheepSoftware/eslint/commit/c7e145933318e8758e334f666eb0ba325f88dbd5))
20
+ * **pkg:** update dependency eslint-plugin-package-json to v0.45.1 ([#949](https://github.com/DarkSheepSoftware/eslint/issues/949)) ([ab071a3](https://github.com/DarkSheepSoftware/eslint/commit/ab071a312e971e9cbd5aca69e1159bb60f2957a1))
21
+ * **pkg:** update eslint monorepo to v9.30.0 ([#944](https://github.com/DarkSheepSoftware/eslint/issues/944)) ([c82ce1d](https://github.com/DarkSheepSoftware/eslint/commit/c82ce1d510a3ac0784c85302d00411cf369cc6dd))
22
+ * **pkg:** update eslint monorepo to v9.31.0 ([#950](https://github.com/DarkSheepSoftware/eslint/issues/950)) ([196315b](https://github.com/DarkSheepSoftware/eslint/commit/196315bc9343a405d3deb0024af7ae4e40acbb2a))
23
+ * **pkg:** update typescript-eslint monorepo to v8.35.0 ([#940](https://github.com/DarkSheepSoftware/eslint/issues/940)) ([c84b7ca](https://github.com/DarkSheepSoftware/eslint/commit/c84b7caa6cd4e4db1c248a5b18952a4d177e6a82))
24
+ * **pkg:** update typescript-eslint monorepo to v8.37.0 ([#948](https://github.com/DarkSheepSoftware/eslint/issues/948)) ([fe66757](https://github.com/DarkSheepSoftware/eslint/commit/fe667578e323520bdc46970c44fe2a3f54a8eb18))
25
+
26
+
27
+ ### ๐Ÿงน Chores
28
+
29
+ * handle being passed a file or a directory in listParents ([#955](https://github.com/DarkSheepSoftware/eslint/issues/955)) ([6dd86ec](https://github.com/DarkSheepSoftware/eslint/commit/6dd86ec2389799eacbe65b5f33bfd698570cc7ab))
30
+
31
+ ## [7.0.4](https://github.com/DarkSheepSoftware/eslint/compare/v7.0.3...v7.0.4) (2025-06-23)
32
+
33
+
34
+ ### ๐Ÿ“ฆ Dependencies
35
+
36
+ * **pkg:** update dependency @eslint/compat to v1.3.0 ([#933](https://github.com/DarkSheepSoftware/eslint/issues/933)) ([58c0c2e](https://github.com/DarkSheepSoftware/eslint/commit/58c0c2ef92d90fd957357989b5e5ad247acde82f))
37
+ * **pkg:** update dependency @stylistic/eslint-plugin to v4.4.1 ([#931](https://github.com/DarkSheepSoftware/eslint/issues/931)) ([38be175](https://github.com/DarkSheepSoftware/eslint/commit/38be175542edb2dd83cf68f6402032bbc9f9d1a6))
38
+ * **pkg:** update dependency editorconfig to v3 ([#932](https://github.com/DarkSheepSoftware/eslint/issues/932)) ([07d4528](https://github.com/DarkSheepSoftware/eslint/commit/07d452847584757ae288edb7e1a02e88b2a0ddd3))
39
+ * **pkg:** update dependency eslint-plugin-jsdoc to v51 ([#934](https://github.com/DarkSheepSoftware/eslint/issues/934)) ([90c3ac8](https://github.com/DarkSheepSoftware/eslint/commit/90c3ac8cb4a7736342e2debe9078e72758fed413))
40
+ * **pkg:** update dependency eslint-plugin-jsdoc to v51.2.1 ([#936](https://github.com/DarkSheepSoftware/eslint/issues/936)) ([6a33cbc](https://github.com/DarkSheepSoftware/eslint/commit/6a33cbcd52fdde7a076f404f3d78ec82285dff73))
41
+ * **pkg:** update dependency eslint-plugin-n to v17.20.0 ([#926](https://github.com/DarkSheepSoftware/eslint/issues/926)) ([2750e25](https://github.com/DarkSheepSoftware/eslint/commit/2750e25208acc3f8522eb853ee561552d3abed9b))
42
+ * **pkg:** update dependency eslint-plugin-package-json to v0.40.4 ([#923](https://github.com/DarkSheepSoftware/eslint/issues/923)) ([939df2e](https://github.com/DarkSheepSoftware/eslint/commit/939df2ebbedff1f5cb09cc5c28a4ec2bb8c68326))
43
+ * **pkg:** update dependency eslint-plugin-perfectionist to v4.15.0 ([#929](https://github.com/DarkSheepSoftware/eslint/issues/929)) ([55705ad](https://github.com/DarkSheepSoftware/eslint/commit/55705ad278908c86568e6799651690a0d1ab4961))
44
+ * **pkg:** update dependency eslint-plugin-regexp to v2.9.0 ([#930](https://github.com/DarkSheepSoftware/eslint/issues/930)) ([9c6f830](https://github.com/DarkSheepSoftware/eslint/commit/9c6f83086e42098532c40a9b3986bb7c00cc0589))
45
+ * **pkg:** update eslint monorepo to v9.29.0 ([#922](https://github.com/DarkSheepSoftware/eslint/issues/922)) ([a920659](https://github.com/DarkSheepSoftware/eslint/commit/a920659a22cd765d3bc6d5c91ac5df9b374009a8))
46
+ * **pkg:** update typescript-eslint monorepo to v8.34.1 ([#927](https://github.com/DarkSheepSoftware/eslint/issues/927)) ([3913a3b](https://github.com/DarkSheepSoftware/eslint/commit/3913a3bf3bc47442722d6359ebefef24a4f6232d))
47
+
3
48
  ## [7.0.3](https://github.com/DarkSheepSoftware/eslint/compare/v7.0.2...v7.0.3) (2025-05-28)
4
49
 
5
50
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@darksheep/eslint",
3
- "version": "7.0.3",
3
+ "version": "8.0.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/DarkSheepSoftware/eslint"
@@ -24,21 +24,21 @@
24
24
  "dependencies": {
25
25
  "@darksheep/environment": "3.1.0",
26
26
  "@eslint-community/eslint-plugin-eslint-comments": "4.5.0",
27
- "@eslint/compat": "1.2.9",
28
- "@eslint/js": "9.27.0",
29
- "@stylistic/eslint-plugin": "4.4.0",
30
- "@typescript-eslint/eslint-plugin": "8.33.0",
31
- "@typescript-eslint/parser": "8.33.0",
32
- "editorconfig": "2.0.1",
33
- "eslint-plugin-jsdoc": "50.6.17",
27
+ "@eslint/compat": "1.3.1",
28
+ "@eslint/js": "9.31.0",
29
+ "@stylistic/eslint-plugin": "5.2.0",
30
+ "@typescript-eslint/eslint-plugin": "8.37.0",
31
+ "@typescript-eslint/parser": "8.37.0",
32
+ "editorconfig": "3.0.1",
33
+ "eslint-plugin-jsdoc": "51.4.1",
34
34
  "eslint-plugin-jsonc": "2.20.1",
35
- "eslint-plugin-n": "17.18.0",
36
- "eslint-plugin-package-json": "0.31.0",
37
- "eslint-plugin-perfectionist": "4.13.0",
35
+ "eslint-plugin-n": "17.21.0",
36
+ "eslint-plugin-package-json": "0.45.1",
37
+ "eslint-plugin-perfectionist": "4.15.0",
38
38
  "eslint-plugin-promise": "7.2.1",
39
39
  "eslint-plugin-react": "7.37.5",
40
40
  "eslint-plugin-react-native": "5.0.0",
41
- "eslint-plugin-regexp": "2.7.0",
41
+ "eslint-plugin-regexp": "2.9.0",
42
42
  "eslint-plugin-security": "3.0.1",
43
43
  "eslint-plugin-unicorn": "59.0.1",
44
44
  "eslint-plugin-unused-imports": "4.1.4",
@@ -48,8 +48,8 @@
48
48
  },
49
49
  "devDependencies": {
50
50
  "@darksheep/eslint-formatter-github": "2.1.0",
51
- "@types/node": "~22.15.0",
52
- "eslint": "~9.27.0",
51
+ "@types/node": "~22.16.0",
52
+ "eslint": "~9.31.0",
53
53
  "type-fest": "~4.41.0",
54
54
  "typescript": "~5.8.0"
55
55
  },
@@ -61,12 +61,12 @@
61
61
  "optional": true
62
62
  }
63
63
  },
64
- "packageManager": "yarn@4.9.1",
64
+ "packageManager": "yarn@4.9.2",
65
65
  "engines": {
66
66
  "node": "^20 || ^22"
67
67
  },
68
68
  "volta": {
69
- "node": "22.16.0",
70
- "yarn": "4.9.1"
69
+ "node": "22.17.1",
70
+ "yarn": "4.9.2"
71
71
  }
72
72
  }
@@ -1,12 +1,33 @@
1
+ /**
2
+ * @import { Linter } from 'eslint'
3
+ */
4
+
1
5
  import js from '@eslint/js';
2
6
 
7
+ /** @type {Linter.RuleEntry} */
8
+ export const unusedConfig = [
9
+ 'error', {
10
+ argsIgnorePattern: '^_',
11
+ varsIgnorePattern: '^_',
12
+ args: 'after-used',
13
+ vars: 'local',
14
+ },
15
+ ];
16
+
3
17
  /**
4
18
  * Get recommended ESLint config.
5
- * @returns {Promise<import('eslint').Linter.Config[]>}
19
+ * @returns {Promise<Linter.FlatConfig[]>}
6
20
  */
7
21
  export async function createEslintRecommendsConfig() {
8
- return [ {
9
- name: 'eslint/recomended',
10
- ...js.configs.recommended,
11
- } ];
22
+ return [
23
+ {
24
+ name: 'eslint/recomended',
25
+ ...js.configs.recommended,
26
+ },
27
+ {
28
+ rules: {
29
+ 'no-unused-vars': unusedConfig,
30
+ },
31
+ },
32
+ ];
12
33
  }
@@ -27,7 +27,14 @@ export async function createEslintJSDocConfig(root) {
27
27
  'jsdoc/check-alignment': 'warn',
28
28
  'jsdoc/check-examples': 'off',
29
29
  'jsdoc/check-indentation': 'off',
30
- 'jsdoc/check-line-alignment': [ 'error', 'never', { customSpacings: { postDelimiter: 1, postTag: 1, postType: 1, postName: 1 } } ],
30
+ 'jsdoc/check-line-alignment': [
31
+ 'error',
32
+ 'never',
33
+ {
34
+ tags: [ 'param', 'arg', 'argument', 'property', 'prop', 'returns', 'return' ],
35
+ customSpacings: { postDelimiter: 1, postTag: 1, postType: 1, postName: 1 },
36
+ },
37
+ ],
31
38
  'jsdoc/check-param-names': 'warn',
32
39
  'jsdoc/check-property-names': 'warn',
33
40
  'jsdoc/check-syntax': 'error',
@@ -22,9 +22,8 @@ export function createEslintStyleConfig() {
22
22
  'style/computed-property-spacing': [ 'error', 'never' ],
23
23
  'style/curly-newline': [ 'error', { consistent: true } ],
24
24
  'style/dot-location': [ 'error', 'property' ],
25
- 'style/func-call-spacing': [ 'error', 'never' ],
26
25
  'style/function-call-argument-newline': [ 'error', 'consistent' ],
27
- 'style/function-call-spacing': 'error',
26
+ 'style/function-call-spacing': [ 'error', 'never' ],
28
27
  'style/function-paren-newline': [ 'error', 'consistent' ],
29
28
  'style/generator-star-spacing': [ 'error', 'both' ],
30
29
  'style/implicit-arrow-linebreak': [ 'error', 'beside' ],
@@ -75,11 +74,29 @@ export function createEslintStyleConfig() {
75
74
  'style/object-curly-spacing': [ 'error', 'always' ],
76
75
  'style/object-property-newline': [ 'error', { allowAllPropertiesOnSameLine: true } ],
77
76
  'style/one-var-declaration-per-line': [ 'error', 'initializations' ],
78
- 'style/operator-linebreak': [ 'error', 'after', { overrides: { '?': 'before', ':': 'before' } } ],
77
+ 'style/operator-linebreak': [
78
+ 'error',
79
+ 'after',
80
+ {
81
+ overrides: {
82
+ '?': 'before',
83
+ ':': 'before',
84
+ '|': 'before',
85
+ '&': 'before',
86
+ },
87
+ },
88
+ ],
79
89
  'style/padded-blocks': [ 'error', 'never' ],
80
90
  'style/padding-line-between-statements': 'off',
81
91
  'style/quote-props': [ 'error', 'consistent-as-needed' ],
82
- 'style/quotes': [ 'error', 'single', { allowTemplateLiterals: true, avoidEscape: true } ],
92
+ 'style/quotes': [
93
+ 'error',
94
+ 'single',
95
+ {
96
+ allowTemplateLiterals: 'always',
97
+ avoidEscape: true,
98
+ },
99
+ ],
83
100
  'style/rest-spread-spacing': [ 'error', 'never' ],
84
101
  'style/semi-spacing': 'error',
85
102
  'style/semi-style': [ 'error', 'last' ],
@@ -1,5 +1,6 @@
1
1
  import unused from 'eslint-plugin-unused-imports';
2
2
 
3
+ import { unusedConfig } from '../configs/eslint-recommended.js';
3
4
  import {
4
5
  getModuleFiles,
5
6
  getTypescriptFiles,
@@ -24,14 +25,7 @@ export async function createEslintUnusedImportsConfig(root) {
24
25
  '@typescript-eslint/no-unused-vars': 'off',
25
26
 
26
27
  'unused-imports/no-unused-imports': 'error',
27
- 'unused-imports/no-unused-vars': [
28
- 'error', {
29
- argsIgnorePattern: '^_',
30
- varsIgnorePattern: '^_',
31
- args: 'after-used',
32
- vars: 'local',
33
- },
34
- ],
28
+ 'unused-imports/no-unused-vars': unusedConfig,
35
29
  },
36
30
  },
37
31
  ];
@@ -1,19 +1,45 @@
1
+ /**
2
+ * @import { Stats } from 'node:fs'
3
+ */
1
4
  import { stat } from 'node:fs/promises';
2
5
  import * as Path from 'node:path';
3
6
 
7
+ /** @type {Map<string, Promise<Stats>>} */
8
+ const cache = new Map();
9
+
4
10
  /**
5
- * @param {string} path - The absolute path to the file to check.
6
- * @returns {Promise<boolean>}
11
+ * @param {string} path - The absolute path to the file to stat.
12
+ * @returns {Promise<Stats | undefined>}
7
13
  */
8
- export async function exists(path) {
14
+ async function safeStat(path) {
9
15
  try {
10
- await stat(path);
11
- return true;
16
+ const promise = cache.get(path) ?? stat(path);
17
+ cache.set(path, promise);
18
+
19
+ return await promise;
12
20
  } catch {
13
- return false;
21
+ // Supress the error and return undefined
22
+ // We dont care about permissions here
14
23
  }
15
24
  }
16
25
 
26
+ /**
27
+ * @param {string} path - The absolute path to the file to check.
28
+ * @returns {Promise<boolean>}
29
+ */
30
+ export async function isFile(path) {
31
+ const stat = await safeStat(path);
32
+ return stat?.isFile() ?? false;
33
+ }
34
+ /**
35
+ * @param {string} path - The absolute path to the file to check.
36
+ * @returns {Promise<boolean>}
37
+ */
38
+ export async function isDirectory(path) {
39
+ const stat = await safeStat(path);
40
+ return stat?.isDirectory() ?? false;
41
+ }
42
+
17
43
  /**
18
44
  * Does {filePath} exist in {projectPath}.
19
45
  * @param {string} [filePath] - The path of the file to check.
@@ -35,15 +61,19 @@ export function descendsFrom(filePath, projectPath) {
35
61
  * Create a list of parent directories from {filepath} to {stopDirectory}.
36
62
  * @param {string} filepath - The file to start from.
37
63
  * @param {string} [stopDirectory] - The directory to stop at.
38
- * @returns {string[]}
64
+ * @returns {Promise<string[]>}
39
65
  */
40
- export function listParents(filepath, stopDirectory = '/') {
66
+ export async function listParents(filepath, stopDirectory = '/') {
41
67
  // The file is not from within the stopDirectory
42
68
  if (descendsFrom(filepath, stopDirectory) === false) {
43
69
  return [];
44
70
  }
45
71
 
46
72
  const output = [];
73
+ if (await isDirectory(filepath)) {
74
+ output.push(filepath);
75
+ }
76
+
47
77
  const end = Path.resolve(stopDirectory);
48
78
  do {
49
79
  filepath = Path.dirname(filepath);
@@ -63,7 +93,7 @@ export async function findInPaths(paths, filename) {
63
93
  for (const directory of paths) {
64
94
  const target = Path.join(directory, filename);
65
95
 
66
- if (await exists(target)) {
96
+ if (await isFile(target)) {
67
97
  return target;
68
98
  }
69
99
  }
@@ -79,5 +109,8 @@ export async function findInPaths(paths, filename) {
79
109
  * @returns {Promise<string|null>} Returns absolute path to the closest {filename} if found.
80
110
  */
81
111
  export async function findUp(rootFilePath, filename, stopDirectory = Path.resolve('/')) {
82
- return findInPaths(listParents(rootFilePath, stopDirectory), filename);
112
+ return findInPaths(
113
+ await listParents(rootFilePath, stopDirectory),
114
+ filename,
115
+ );
83
116
  }
@@ -14,11 +14,12 @@ const cache = new Map();
14
14
  /**
15
15
  * @param {string} rootPath - The root url.
16
16
  * @param {string} packageName - The target package name.
17
- * @returns {string[]}
17
+ * @returns {Promise<string[]>}
18
18
  */
19
- function modulePaths(rootPath, packageName) {
20
- return listParents(`${rootPath}/eslint.config.js`)
21
- .map((path) => resolve(path, 'node_modules', packageName));
19
+ async function modulePaths(rootPath, packageName) {
20
+ const parents = await listParents(`${rootPath}/eslint.config.js`);
21
+
22
+ return parents.map((path) => resolve(path, 'node_modules', packageName));
22
23
  }
23
24
 
24
25
  /**
@@ -34,7 +35,7 @@ export async function getPackageJson(rootUrl, packageName) {
34
35
  }
35
36
 
36
37
  const jsonPath = typeof packageName === 'string'
37
- ? await findInPaths(modulePaths(root, packageName), 'package.json')
38
+ ? await findInPaths(await modulePaths(root, packageName), 'package.json')
38
39
  : await findUp(root, 'package.json');
39
40
 
40
41
  if (jsonPath == null) {
@@ -1,5 +1,8 @@
1
1
  /**
2
2
  * Get recommended ESLint config.
3
- * @returns {Promise<import('eslint').Linter.Config[]>}
3
+ * @returns {Promise<Linter.FlatConfig[]>}
4
4
  */
5
- export function createEslintRecommendsConfig(): Promise<import("eslint").Linter.Config[]>;
5
+ export function createEslintRecommendsConfig(): Promise<Linter.FlatConfig[]>;
6
+ /** @type {Linter.RuleEntry} */
7
+ export const unusedConfig: Linter.RuleEntry;
8
+ import type { Linter } from 'eslint';
@@ -2,7 +2,12 @@
2
2
  * @param {string} path - The absolute path to the file to check.
3
3
  * @returns {Promise<boolean>}
4
4
  */
5
- export function exists(path: string): Promise<boolean>;
5
+ export function isFile(path: string): Promise<boolean>;
6
+ /**
7
+ * @param {string} path - The absolute path to the file to check.
8
+ * @returns {Promise<boolean>}
9
+ */
10
+ export function isDirectory(path: string): Promise<boolean>;
6
11
  /**
7
12
  * Does {filePath} exist in {projectPath}.
8
13
  * @param {string} [filePath] - The path of the file to check.
@@ -14,9 +19,9 @@ export function descendsFrom(filePath?: string, projectPath?: string): boolean;
14
19
  * Create a list of parent directories from {filepath} to {stopDirectory}.
15
20
  * @param {string} filepath - The file to start from.
16
21
  * @param {string} [stopDirectory] - The directory to stop at.
17
- * @returns {string[]}
22
+ * @returns {Promise<string[]>}
18
23
  */
19
- export function listParents(filepath: string, stopDirectory?: string): string[];
24
+ export function listParents(filepath: string, stopDirectory?: string): Promise<string[]>;
20
25
  /**
21
26
  * Find the closest {filename} starting from {rootFilePath}.
22
27
  * @param {string[]} paths - The paths to search in.