eslint-config-decent 2.2.3 → 2.3.1
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/index.cjs +7 -6
- package/dist/index.mjs +3 -2
- package/package.json +17 -17
- package/src/rules/requireExtensionRule.ts +2 -2
- package/src/rules/requireIndexRule.ts +2 -2
- package/src/unicorn.ts +1 -0
package/dist/index.cjs
CHANGED
|
@@ -4,8 +4,8 @@ const eslint = require('@eslint/js');
|
|
|
4
4
|
const prettier = require('eslint-plugin-prettier/recommended');
|
|
5
5
|
const globals = require('globals');
|
|
6
6
|
const tsEslint = require('typescript-eslint');
|
|
7
|
-
const
|
|
8
|
-
const
|
|
7
|
+
const node_fs = require('node:fs');
|
|
8
|
+
const node_path = require('node:path');
|
|
9
9
|
const utils = require('@typescript-eslint/utils');
|
|
10
10
|
const importPlugin = require('eslint-plugin-import-x');
|
|
11
11
|
const jest = require('eslint-plugin-jest');
|
|
@@ -316,8 +316,8 @@ const requireExtensionRule = utils.ESLintUtils.RuleCreator(() => "https://github
|
|
|
316
316
|
if (!importPath || !importPath.startsWith(".") || importPath.endsWith(".js")) {
|
|
317
317
|
return;
|
|
318
318
|
}
|
|
319
|
-
const resolvedPath =
|
|
320
|
-
if (!
|
|
319
|
+
const resolvedPath = node_path.resolve(node_path.dirname(context.filename), importPath);
|
|
320
|
+
if (!node_fs.existsSync(resolvedPath)) {
|
|
321
321
|
context.report({
|
|
322
322
|
node: source,
|
|
323
323
|
messageId: "requireExtension",
|
|
@@ -361,8 +361,8 @@ const requireIndexRule = utils.ESLintUtils.RuleCreator(() => "https://github.com
|
|
|
361
361
|
create(context) {
|
|
362
362
|
function checkSource(source) {
|
|
363
363
|
const importPath = source.value;
|
|
364
|
-
const resolvedPath =
|
|
365
|
-
const isDirectory =
|
|
364
|
+
const resolvedPath = node_path.resolve(node_path.dirname(context.filename), importPath);
|
|
365
|
+
const isDirectory = node_fs.existsSync(resolvedPath) && node_fs.lstatSync(resolvedPath).isDirectory();
|
|
366
366
|
if (isDirectory) {
|
|
367
367
|
context.report({
|
|
368
368
|
node: source,
|
|
@@ -737,6 +737,7 @@ const base = {
|
|
|
737
737
|
"unicorn/no-array-method-this-argument": "error",
|
|
738
738
|
"unicorn/no-for-loop": "error",
|
|
739
739
|
"unicorn/prefer-array-find": "error",
|
|
740
|
+
"unicorn/prefer-node-protocol": "error",
|
|
740
741
|
"unicorn/prefer-object-from-entries": "error",
|
|
741
742
|
"unicorn/prefer-set-has": "error"
|
|
742
743
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -2,8 +2,8 @@ import eslint from '@eslint/js';
|
|
|
2
2
|
import prettier from 'eslint-plugin-prettier/recommended';
|
|
3
3
|
import globals from 'globals';
|
|
4
4
|
import tsEslint from 'typescript-eslint';
|
|
5
|
-
import { existsSync, lstatSync } from 'fs';
|
|
6
|
-
import { resolve, dirname } from 'path';
|
|
5
|
+
import { existsSync, lstatSync } from 'node:fs';
|
|
6
|
+
import { resolve, dirname } from 'node:path';
|
|
7
7
|
import { ESLintUtils } from '@typescript-eslint/utils';
|
|
8
8
|
import importPlugin from 'eslint-plugin-import-x';
|
|
9
9
|
import jest from 'eslint-plugin-jest';
|
|
@@ -716,6 +716,7 @@ const base = {
|
|
|
716
716
|
"unicorn/no-array-method-this-argument": "error",
|
|
717
717
|
"unicorn/no-for-loop": "error",
|
|
718
718
|
"unicorn/prefer-array-find": "error",
|
|
719
|
+
"unicorn/prefer-node-protocol": "error",
|
|
719
720
|
"unicorn/prefer-object-from-entries": "error",
|
|
720
721
|
"unicorn/prefer-set-has": "error"
|
|
721
722
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-config-decent",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.1",
|
|
4
4
|
"description": "A decent ESLint configuration",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -72,38 +72,38 @@
|
|
|
72
72
|
"node": ">=20.11.0"
|
|
73
73
|
},
|
|
74
74
|
"dependencies": {
|
|
75
|
-
"@eslint/compat": "1.2.
|
|
76
|
-
"@eslint/js": "9.
|
|
77
|
-
"@typescript-eslint/utils": "8.
|
|
75
|
+
"@eslint/compat": "1.2.4",
|
|
76
|
+
"@eslint/js": "9.17.0",
|
|
77
|
+
"@typescript-eslint/utils": "8.19.1",
|
|
78
78
|
"eslint-config-prettier": "9.1.0",
|
|
79
|
-
"eslint-plugin-import-x": "4.
|
|
80
|
-
"eslint-plugin-jest": "28.
|
|
79
|
+
"eslint-plugin-import-x": "4.6.1",
|
|
80
|
+
"eslint-plugin-jest": "28.10.0",
|
|
81
81
|
"eslint-plugin-jest-dom": "5.5.0",
|
|
82
|
-
"eslint-plugin-jsdoc": "50.6.
|
|
82
|
+
"eslint-plugin-jsdoc": "50.6.1",
|
|
83
83
|
"eslint-plugin-jsx-a11y": "6.10.2",
|
|
84
84
|
"eslint-plugin-mocha": "10.5.0",
|
|
85
85
|
"eslint-plugin-prettier": "5.2.1",
|
|
86
86
|
"eslint-plugin-promise": "7.2.1",
|
|
87
|
-
"eslint-plugin-react": "7.37.
|
|
88
|
-
"eslint-plugin-react-hooks": "5.
|
|
87
|
+
"eslint-plugin-react": "7.37.3",
|
|
88
|
+
"eslint-plugin-react-hooks": "5.1.0",
|
|
89
89
|
"eslint-plugin-security": "3.0.1",
|
|
90
|
-
"eslint-plugin-testing-library": "7.
|
|
90
|
+
"eslint-plugin-testing-library": "7.1.1",
|
|
91
91
|
"eslint-plugin-unicorn": "56.0.1",
|
|
92
|
-
"globals": "15.
|
|
93
|
-
"typescript-eslint": "8.
|
|
92
|
+
"globals": "15.14.0",
|
|
93
|
+
"typescript-eslint": "8.19.1"
|
|
94
94
|
},
|
|
95
95
|
"devDependencies": {
|
|
96
|
-
"@swc/core": "^1.
|
|
96
|
+
"@swc/core": "^1.10.6",
|
|
97
97
|
"@types/node": ">=22",
|
|
98
|
-
"eslint": "^9.
|
|
98
|
+
"eslint": "^9.17.0",
|
|
99
99
|
"husky": "^9.1.7",
|
|
100
|
-
"lint-staged": "^15.
|
|
100
|
+
"lint-staged": "^15.3.0",
|
|
101
101
|
"markdownlint-cli": "^0.43.0",
|
|
102
102
|
"npm-run-all": "^4.1.5",
|
|
103
103
|
"pinst": "^3.0.0",
|
|
104
|
-
"prettier": "^3.4.
|
|
104
|
+
"prettier": "^3.4.2",
|
|
105
105
|
"typescript": "^5.7.2",
|
|
106
|
-
"unbuild": "2.0
|
|
106
|
+
"unbuild": "3.2.0"
|
|
107
107
|
},
|
|
108
108
|
"overrides": {
|
|
109
109
|
"eslint-plugin-jsx-a11y": {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { existsSync } from 'fs';
|
|
2
|
-
import { dirname, resolve } from 'path';
|
|
1
|
+
import { existsSync } from 'node:fs';
|
|
2
|
+
import { dirname, resolve } from 'node:path';
|
|
3
3
|
|
|
4
4
|
import type { TSESTree } from '@typescript-eslint/utils';
|
|
5
5
|
import { ESLintUtils } from '@typescript-eslint/utils';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { existsSync, lstatSync } from 'fs';
|
|
2
|
-
import { dirname, resolve } from 'path';
|
|
1
|
+
import { existsSync, lstatSync } from 'node:fs';
|
|
2
|
+
import { dirname, resolve } from 'node:path';
|
|
3
3
|
|
|
4
4
|
import type { TSESTree } from '@typescript-eslint/utils';
|
|
5
5
|
import { ESLintUtils } from '@typescript-eslint/utils';
|
package/src/unicorn.ts
CHANGED
|
@@ -11,6 +11,7 @@ const base: TSESLint.FlatConfig.Config = {
|
|
|
11
11
|
'unicorn/no-array-method-this-argument': 'error',
|
|
12
12
|
'unicorn/no-for-loop': 'error',
|
|
13
13
|
'unicorn/prefer-array-find': 'error',
|
|
14
|
+
'unicorn/prefer-node-protocol': 'error',
|
|
14
15
|
'unicorn/prefer-object-from-entries': 'error',
|
|
15
16
|
'unicorn/prefer-set-has': 'error',
|
|
16
17
|
},
|