@sapphire-sh/utils 1.37.0 → 1.38.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/lib/eslint.d.ts +24 -0
- package/lib/eslint.js +76 -0
- package/package.json +24 -2
package/lib/eslint.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
declare const config: ({
|
|
2
|
+
readonly rules: Readonly<import("eslint").Linter.RulesRecord>;
|
|
3
|
+
} | import("typescript-eslint/dist/compatibility-types").CompatibleConfig | {
|
|
4
|
+
rules: {
|
|
5
|
+
'@typescript-eslint/no-floating-promises': string;
|
|
6
|
+
'@typescript-eslint/no-misused-promises': string;
|
|
7
|
+
'@typescript-eslint/no-unnecessary-condition': string;
|
|
8
|
+
'@typescript-eslint/switch-exhaustiveness-check': string;
|
|
9
|
+
'@typescript-eslint/return-await': string[];
|
|
10
|
+
'@typescript-eslint/prefer-readonly': string;
|
|
11
|
+
'@typescript-eslint/strict-boolean-expressions': string;
|
|
12
|
+
};
|
|
13
|
+
languageOptions: {
|
|
14
|
+
parserOptions: {
|
|
15
|
+
project: boolean;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
ignores?: undefined;
|
|
19
|
+
} | {
|
|
20
|
+
ignores: string[];
|
|
21
|
+
rules?: undefined;
|
|
22
|
+
languageOptions?: undefined;
|
|
23
|
+
})[];
|
|
24
|
+
export default config;
|
package/lib/eslint.js
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const js_1 = __importDefault(require("@eslint/js"));
|
|
7
|
+
const eslint_config_prettier_1 = __importDefault(require("eslint-config-prettier"));
|
|
8
|
+
const typescript_eslint_1 = __importDefault(require("typescript-eslint"));
|
|
9
|
+
const config = [
|
|
10
|
+
js_1.default.configs.recommended,
|
|
11
|
+
...typescript_eslint_1.default.configs.recommended,
|
|
12
|
+
eslint_config_prettier_1.default,
|
|
13
|
+
{
|
|
14
|
+
rules: {
|
|
15
|
+
// General
|
|
16
|
+
'no-console': 'off',
|
|
17
|
+
'no-constant-condition': ['error', { checkLoops: false }],
|
|
18
|
+
'no-var': 'error',
|
|
19
|
+
'no-throw-literal': 'error',
|
|
20
|
+
'no-param-reassign': 'error',
|
|
21
|
+
'no-nested-ternary': 'error',
|
|
22
|
+
'no-unneeded-ternary': 'error',
|
|
23
|
+
'prefer-const': 'error',
|
|
24
|
+
'prefer-template': 'error',
|
|
25
|
+
'prefer-destructuring': 'error',
|
|
26
|
+
'prefer-arrow-callback': 'error',
|
|
27
|
+
'eqeqeq': ['error', 'always'],
|
|
28
|
+
'object-shorthand': 'error',
|
|
29
|
+
'no-else-return': 'error',
|
|
30
|
+
'arrow-body-style': ['error', 'as-needed'],
|
|
31
|
+
'func-style': ['error', 'expression'],
|
|
32
|
+
'yoda': 'error',
|
|
33
|
+
// TypeScript
|
|
34
|
+
'@typescript-eslint/no-unused-vars': ['error', { varsIgnorePattern: '^_', argsIgnorePattern: '^_' }],
|
|
35
|
+
'@typescript-eslint/naming-convention': [
|
|
36
|
+
'error',
|
|
37
|
+
{
|
|
38
|
+
selector: 'interface',
|
|
39
|
+
format: ['PascalCase'],
|
|
40
|
+
custom: { regex: '^I[A-Z]', match: false },
|
|
41
|
+
},
|
|
42
|
+
],
|
|
43
|
+
'@typescript-eslint/no-namespace': 'off',
|
|
44
|
+
'@typescript-eslint/no-shadow': 'off',
|
|
45
|
+
'@typescript-eslint/consistent-type-imports': 'error',
|
|
46
|
+
'@typescript-eslint/consistent-type-definitions': ['error', 'interface'],
|
|
47
|
+
'@typescript-eslint/no-explicit-any': 'warn',
|
|
48
|
+
'@typescript-eslint/no-non-null-assertion': 'warn',
|
|
49
|
+
'@typescript-eslint/no-unnecessary-type-assertion': 'error',
|
|
50
|
+
'@typescript-eslint/array-type': ['error', { default: 'array' }],
|
|
51
|
+
'@typescript-eslint/prefer-nullish-coalescing': 'error',
|
|
52
|
+
'@typescript-eslint/prefer-optional-chain': 'error',
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
// Type-aware rules (requires parserOptions.project in consumer config)
|
|
57
|
+
rules: {
|
|
58
|
+
'@typescript-eslint/no-floating-promises': 'error',
|
|
59
|
+
'@typescript-eslint/no-misused-promises': 'error',
|
|
60
|
+
'@typescript-eslint/no-unnecessary-condition': 'error',
|
|
61
|
+
'@typescript-eslint/switch-exhaustiveness-check': 'error',
|
|
62
|
+
'@typescript-eslint/return-await': ['error', 'in-try-catch'],
|
|
63
|
+
'@typescript-eslint/prefer-readonly': 'error',
|
|
64
|
+
'@typescript-eslint/strict-boolean-expressions': 'error',
|
|
65
|
+
},
|
|
66
|
+
languageOptions: {
|
|
67
|
+
parserOptions: {
|
|
68
|
+
project: true,
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
ignores: ['**/*.json', 'node_modules/'],
|
|
74
|
+
},
|
|
75
|
+
];
|
|
76
|
+
exports.default = config;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sapphire-sh/utils",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.38.0",
|
|
4
4
|
"description": "@sapphire-sh/utils",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"types": "./lib/index.d.ts",
|
|
@@ -25,14 +25,36 @@
|
|
|
25
25
|
},
|
|
26
26
|
"homepage": "https://github.com/sapphire-sh/sapphire-utils#readme",
|
|
27
27
|
"peerDependencies": {
|
|
28
|
+
"@eslint/js": ">=9.0.0",
|
|
29
|
+
"eslint": ">=9.0.0",
|
|
30
|
+
"eslint-config-prettier": ">=9.0.0",
|
|
28
31
|
"prettier": ">=3.0.0",
|
|
29
|
-
"prettier-plugin-organize-imports": ">=4.0.0"
|
|
32
|
+
"prettier-plugin-organize-imports": ">=4.0.0",
|
|
33
|
+
"typescript-eslint": ">=8.0.0"
|
|
34
|
+
},
|
|
35
|
+
"peerDependenciesMeta": {
|
|
36
|
+
"@eslint/js": {
|
|
37
|
+
"optional": true
|
|
38
|
+
},
|
|
39
|
+
"eslint": {
|
|
40
|
+
"optional": true
|
|
41
|
+
},
|
|
42
|
+
"eslint-config-prettier": {
|
|
43
|
+
"optional": true
|
|
44
|
+
},
|
|
45
|
+
"typescript-eslint": {
|
|
46
|
+
"optional": true
|
|
47
|
+
}
|
|
30
48
|
},
|
|
31
49
|
"devDependencies": {
|
|
50
|
+
"@eslint/js": "^9.24.0",
|
|
32
51
|
"@vitest/coverage-v8": "^4.1.1",
|
|
52
|
+
"eslint": "^9.24.0",
|
|
53
|
+
"eslint-config-prettier": "^10.1.2",
|
|
33
54
|
"prettier": "^3.8.1",
|
|
34
55
|
"prettier-plugin-organize-imports": "^4.3.0",
|
|
35
56
|
"typescript": "^5.9.3",
|
|
57
|
+
"typescript-eslint": "^8.29.1",
|
|
36
58
|
"vitest": "^4.1.1"
|
|
37
59
|
}
|
|
38
60
|
}
|