eslint-config-salesforce-typescript 4.0.1 → 6.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/index.mjs +155 -0
- package/package.json +26 -21
- package/index.js +0 -122
package/index.mjs
ADDED
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import eslint from '@eslint/js';
|
|
2
|
+
import tseslint from 'typescript-eslint';
|
|
3
|
+
import eslintConfigPrettier from 'eslint-config-prettier';
|
|
4
|
+
import importPlugin from 'eslint-plugin-import-x';
|
|
5
|
+
import jsdocPlugin from 'eslint-plugin-jsdoc';
|
|
6
|
+
import unicornPlugin from 'eslint-plugin-unicorn';
|
|
7
|
+
import headerPlugin from '@tony.ganchev/eslint-plugin-header';
|
|
8
|
+
|
|
9
|
+
export default tseslint.config(
|
|
10
|
+
{
|
|
11
|
+
ignores: ['**/node_modules/**', 'lib/**', '**/*.js', '**/*.cjs', '**/*.mjs'],
|
|
12
|
+
},
|
|
13
|
+
eslint.configs.recommended,
|
|
14
|
+
...tseslint.configs.recommendedTypeChecked,
|
|
15
|
+
{
|
|
16
|
+
languageOptions: {
|
|
17
|
+
parserOptions: {
|
|
18
|
+
projectService: true,
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
plugins: {
|
|
22
|
+
'import-x': importPlugin,
|
|
23
|
+
jsdoc: jsdocPlugin,
|
|
24
|
+
unicorn: unicornPlugin,
|
|
25
|
+
header: headerPlugin,
|
|
26
|
+
},
|
|
27
|
+
rules: {
|
|
28
|
+
'valid-typeof': 'off',
|
|
29
|
+
'arrow-body-style': 'error',
|
|
30
|
+
'prefer-arrow-callback': 'error',
|
|
31
|
+
camelcase: 'error',
|
|
32
|
+
complexity: 'error',
|
|
33
|
+
curly: ['error', 'multi-line'],
|
|
34
|
+
'class-methods-use-this': 'error',
|
|
35
|
+
eqeqeq: ['error', 'smart'],
|
|
36
|
+
'guard-for-in': 'error',
|
|
37
|
+
'id-denylist': 'error',
|
|
38
|
+
'id-match': 'error',
|
|
39
|
+
'no-await-in-loop': 'error',
|
|
40
|
+
'no-caller': 'error',
|
|
41
|
+
'no-console': 'error',
|
|
42
|
+
'no-eval': 'error',
|
|
43
|
+
'no-lonely-if': 'error',
|
|
44
|
+
'no-new-wrappers': 'error',
|
|
45
|
+
'no-octal-escape': 'error',
|
|
46
|
+
'no-restricted-imports': [
|
|
47
|
+
'error',
|
|
48
|
+
{
|
|
49
|
+
patterns: [
|
|
50
|
+
{
|
|
51
|
+
group: ['src/**'],
|
|
52
|
+
message: "imports from this repo's src folder should be a relative path",
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
group: ['**/../lib/**', 'lib/**'],
|
|
56
|
+
message: 'import from /src not from /lib. /lib is a build artifact',
|
|
57
|
+
},
|
|
58
|
+
],
|
|
59
|
+
},
|
|
60
|
+
],
|
|
61
|
+
'no-shadow': 'off',
|
|
62
|
+
'no-throw-literal': 'error',
|
|
63
|
+
'no-undef-init': 'error',
|
|
64
|
+
'no-underscore-dangle': 'error',
|
|
65
|
+
'no-unsafe-finally': 'error',
|
|
66
|
+
'no-unused-expressions': 'error',
|
|
67
|
+
'no-var': 'error',
|
|
68
|
+
'object-shorthand': 'error',
|
|
69
|
+
'one-var': ['error', 'never'],
|
|
70
|
+
'prefer-const': 'error',
|
|
71
|
+
'prefer-spread': 'error',
|
|
72
|
+
radix: 'error',
|
|
73
|
+
'spaced-comment': ['error', 'always', { markers: ['/'] }],
|
|
74
|
+
'use-isnan': 'error',
|
|
75
|
+
|
|
76
|
+
'import-x/order': 'error',
|
|
77
|
+
|
|
78
|
+
'jsdoc/check-alignment': 'error',
|
|
79
|
+
'jsdoc/check-indentation': 'error',
|
|
80
|
+
'jsdoc/tag-lines': [2, 'any', { startLines: 1, endLines: 1 }],
|
|
81
|
+
|
|
82
|
+
'unicorn/prefer-node-protocol': 'error',
|
|
83
|
+
|
|
84
|
+
'@typescript-eslint/no-explicit-any': 'error',
|
|
85
|
+
'@typescript-eslint/no-namespace': 'off',
|
|
86
|
+
'@typescript-eslint/restrict-template-expressions': [
|
|
87
|
+
'error',
|
|
88
|
+
{ allowNullish: true, allowBoolean: true, allowNumber: true },
|
|
89
|
+
],
|
|
90
|
+
'@typescript-eslint/array-type': ['error', { default: 'array-simple' }],
|
|
91
|
+
'@typescript-eslint/consistent-type-assertions': 'error',
|
|
92
|
+
'@typescript-eslint/explicit-function-return-type': 'error',
|
|
93
|
+
'@typescript-eslint/explicit-member-accessibility': ['error', { accessibility: 'explicit' }],
|
|
94
|
+
'@typescript-eslint/member-ordering': 'error',
|
|
95
|
+
'@typescript-eslint/no-shadow': 'error',
|
|
96
|
+
'@typescript-eslint/return-await': 'error',
|
|
97
|
+
'@typescript-eslint/prefer-for-of': 'error',
|
|
98
|
+
'@typescript-eslint/prefer-function-type': 'error',
|
|
99
|
+
'@typescript-eslint/prefer-includes': 'error',
|
|
100
|
+
'@typescript-eslint/prefer-nullish-coalescing': 'error',
|
|
101
|
+
'@typescript-eslint/prefer-optional-chain': 'error',
|
|
102
|
+
'@typescript-eslint/prefer-reduce-type-parameter': 'error',
|
|
103
|
+
'@typescript-eslint/prefer-string-starts-ends-with': 'error',
|
|
104
|
+
'@typescript-eslint/switch-exhaustiveness-check': 'error',
|
|
105
|
+
'@typescript-eslint/unified-signatures': 'error',
|
|
106
|
+
|
|
107
|
+
'header/header': [
|
|
108
|
+
2,
|
|
109
|
+
'block',
|
|
110
|
+
[
|
|
111
|
+
'',
|
|
112
|
+
{
|
|
113
|
+
pattern: ' \\* Copyright \\d{4}, Salesforce, Inc\\.',
|
|
114
|
+
template: ' * Copyright 2025, Salesforce, Inc.',
|
|
115
|
+
},
|
|
116
|
+
' *',
|
|
117
|
+
' * Licensed under the Apache License, Version 2.0 (the "License");',
|
|
118
|
+
' * you may not use this file except in compliance with the License.',
|
|
119
|
+
' * You may obtain a copy of the License at',
|
|
120
|
+
' *',
|
|
121
|
+
' * http://www.apache.org/licenses/LICENSE-2.0',
|
|
122
|
+
' *',
|
|
123
|
+
' * Unless required by applicable law or agreed to in writing, software',
|
|
124
|
+
' * distributed under the License is distributed on an "AS IS" BASIS,',
|
|
125
|
+
' * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.',
|
|
126
|
+
' * See the License for the specific language governing permissions and',
|
|
127
|
+
' * limitations under the License.',
|
|
128
|
+
' ',
|
|
129
|
+
],
|
|
130
|
+
],
|
|
131
|
+
},
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
files: ['src/**/*.ts'],
|
|
135
|
+
rules: {
|
|
136
|
+
'@typescript-eslint/restrict-template-expressions': [
|
|
137
|
+
'error',
|
|
138
|
+
{ allowNullish: false, allowBoolean: true, allowNumber: true },
|
|
139
|
+
],
|
|
140
|
+
},
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
files: ['test/**/*.ts'],
|
|
144
|
+
rules: {
|
|
145
|
+
'no-unused-expressions': 'off',
|
|
146
|
+
'@typescript-eslint/no-unused-expressions': 'off',
|
|
147
|
+
'@typescript-eslint/explicit-function-return-type': 'off',
|
|
148
|
+
'@typescript-eslint/no-empty-function': 'off',
|
|
149
|
+
'@typescript-eslint/no-unsafe-function-type': 'off',
|
|
150
|
+
'@typescript-eslint/no-unsafe-assignment': 'off',
|
|
151
|
+
'@typescript-eslint/require-await': 'off',
|
|
152
|
+
},
|
|
153
|
+
},
|
|
154
|
+
eslintConfigPrettier
|
|
155
|
+
);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-config-salesforce-typescript",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "The eslint config for Salesforce typescript projects",
|
|
3
|
+
"version": "6.0.0",
|
|
4
|
+
"description": "The eslint flat config for Salesforce typescript projects",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Salesforce",
|
|
7
7
|
"eslint",
|
|
@@ -10,36 +10,41 @@
|
|
|
10
10
|
"author": "Salesforce",
|
|
11
11
|
"homepage": "https://github.com/forcedotcom/eslint-config-salesforce-typescript#readme",
|
|
12
12
|
"license": "Apache-2.0",
|
|
13
|
-
"
|
|
13
|
+
"type": "module",
|
|
14
|
+
"exports": {
|
|
15
|
+
".": "./index.mjs",
|
|
16
|
+
"./package.json": "./package.json"
|
|
17
|
+
},
|
|
14
18
|
"files": [
|
|
15
|
-
"
|
|
19
|
+
"index.mjs"
|
|
16
20
|
],
|
|
17
21
|
"repository": "forcedotcom/eslint-config-salesforce-typescript",
|
|
18
22
|
"bugs": {
|
|
19
23
|
"url": "https://github.com/forcedotcom/eslint-config-salesforce-typescript/issues"
|
|
20
24
|
},
|
|
21
|
-
"devDependencies": {
|
|
22
|
-
"@salesforce/prettier-config": "^0.0.3",
|
|
23
|
-
"prettier": "^3.3.3",
|
|
24
|
-
"typescript": "^5.4.5"
|
|
25
|
-
},
|
|
26
25
|
"publishConfig": {
|
|
27
26
|
"access": "public"
|
|
28
27
|
},
|
|
29
28
|
"scripts": {
|
|
30
|
-
"
|
|
31
|
-
"
|
|
29
|
+
"build": "echo 'no build necessary'",
|
|
30
|
+
"test": "node --input-type=module -e \"import config from './index.mjs'; assert(Array.isArray(config), 'expected array'); console.log('ok:', config.length, 'config entries');\""
|
|
32
31
|
},
|
|
33
32
|
"dependencies": {
|
|
34
|
-
"@
|
|
35
|
-
"@
|
|
36
|
-
"eslint": "^
|
|
37
|
-
"eslint-
|
|
38
|
-
"eslint-
|
|
39
|
-
"eslint-
|
|
40
|
-
"
|
|
41
|
-
"eslint
|
|
42
|
-
|
|
43
|
-
|
|
33
|
+
"@eslint/js": "^10.0.0",
|
|
34
|
+
"@tony.ganchev/eslint-plugin-header": "^3.4.4",
|
|
35
|
+
"eslint-config-prettier": "^10.1.5",
|
|
36
|
+
"eslint-plugin-import-x": "^4.17.1",
|
|
37
|
+
"eslint-plugin-jsdoc": "^63.3.2",
|
|
38
|
+
"eslint-plugin-unicorn": "^72.0.0",
|
|
39
|
+
"globals": "^15.14.0",
|
|
40
|
+
"typescript-eslint": "^8.66.0"
|
|
41
|
+
},
|
|
42
|
+
"peerDependencies": {
|
|
43
|
+
"eslint": "^10.0.0",
|
|
44
|
+
"typescript": "^5.5.4 || ^6"
|
|
45
|
+
},
|
|
46
|
+
"devDependencies": {
|
|
47
|
+
"eslint": "^10.4.0",
|
|
48
|
+
"typescript": "^5.5.4"
|
|
44
49
|
}
|
|
45
50
|
}
|
package/index.js
DELETED
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
env: {
|
|
3
|
-
es6: true,
|
|
4
|
-
},
|
|
5
|
-
extends: [
|
|
6
|
-
'eslint-config-salesforce',
|
|
7
|
-
'plugin:@typescript-eslint/eslint-recommended',
|
|
8
|
-
'plugin:@typescript-eslint/recommended',
|
|
9
|
-
'plugin:@typescript-eslint/recommended-requiring-type-checking',
|
|
10
|
-
'eslint-config-prettier',
|
|
11
|
-
],
|
|
12
|
-
parser: '@typescript-eslint/parser',
|
|
13
|
-
parserOptions: {
|
|
14
|
-
project: [
|
|
15
|
-
'./packages/**/tsconfig.json',
|
|
16
|
-
'./packages/**/test/tsconfig.json',
|
|
17
|
-
'./tsconfig.json',
|
|
18
|
-
'./test/tsconfig.json',
|
|
19
|
-
],
|
|
20
|
-
sourceType: 'module',
|
|
21
|
-
},
|
|
22
|
-
plugins: ['@typescript-eslint', 'eslint-plugin-import', 'eslint-plugin-jsdoc', 'unicorn'],
|
|
23
|
-
rules: {
|
|
24
|
-
'unicorn/prefer-node-protocol': 'error',
|
|
25
|
-
'unicorn/numeric-separators-style': 'warn',
|
|
26
|
-
// turn the rule off everywhere. Then, in overrides, turn it on for just src
|
|
27
|
-
'import/no-extraneous-dependencies': ['off'],
|
|
28
|
-
|
|
29
|
-
// Override @typescript-eslint/recommended
|
|
30
|
-
'@typescript-eslint/no-explicit-any': 'error',
|
|
31
|
-
'@typescript-eslint/no-namespace': 'off',
|
|
32
|
-
'@typescript-eslint/restrict-template-expressions': [
|
|
33
|
-
'error',
|
|
34
|
-
{
|
|
35
|
-
// true generally (so we get it in /test), we override it to false for src lower down
|
|
36
|
-
allowNullish: true,
|
|
37
|
-
allowBoolean: true,
|
|
38
|
-
allowNumber: true,
|
|
39
|
-
},
|
|
40
|
-
],
|
|
41
|
-
|
|
42
|
-
// Custom @typescript-eslint
|
|
43
|
-
'@typescript-eslint/array-type': [
|
|
44
|
-
'error',
|
|
45
|
-
{
|
|
46
|
-
default: 'array-simple',
|
|
47
|
-
},
|
|
48
|
-
],
|
|
49
|
-
'@typescript-eslint/consistent-type-assertions': 'error',
|
|
50
|
-
'@typescript-eslint/consistent-type-definitions': ['warn', 'type'],
|
|
51
|
-
'@typescript-eslint/explicit-function-return-type': 'error',
|
|
52
|
-
'@typescript-eslint/explicit-member-accessibility': [
|
|
53
|
-
'error',
|
|
54
|
-
{
|
|
55
|
-
accessibility: 'explicit',
|
|
56
|
-
},
|
|
57
|
-
],
|
|
58
|
-
'@typescript-eslint/member-delimiter-style': [
|
|
59
|
-
'error',
|
|
60
|
-
{
|
|
61
|
-
multiline: {
|
|
62
|
-
delimiter: 'semi',
|
|
63
|
-
requireLast: true,
|
|
64
|
-
},
|
|
65
|
-
singleline: {
|
|
66
|
-
delimiter: 'semi',
|
|
67
|
-
requireLast: false,
|
|
68
|
-
},
|
|
69
|
-
},
|
|
70
|
-
],
|
|
71
|
-
'@typescript-eslint/member-ordering': 'error',
|
|
72
|
-
'@typescript-eslint/no-shadow': 'error',
|
|
73
|
-
'@typescript-eslint/return-await': 'error',
|
|
74
|
-
// turning off the base rule is recommended by ts-eslint
|
|
75
|
-
'no-return-await': 'off',
|
|
76
|
-
'@typescript-eslint/prefer-for-of': 'error',
|
|
77
|
-
'@typescript-eslint/prefer-function-type': 'error',
|
|
78
|
-
'@typescript-eslint/prefer-includes': 'error',
|
|
79
|
-
'@typescript-eslint/prefer-nullish-coalescing': 'error',
|
|
80
|
-
'@typescript-eslint/prefer-optional-chain': 'error',
|
|
81
|
-
'@typescript-eslint/prefer-reduce-type-parameter': 'error',
|
|
82
|
-
'@typescript-eslint/prefer-string-starts-ends-with': 'error',
|
|
83
|
-
'@typescript-eslint/quotes': [
|
|
84
|
-
'error',
|
|
85
|
-
'single',
|
|
86
|
-
{
|
|
87
|
-
avoidEscape: true,
|
|
88
|
-
},
|
|
89
|
-
],
|
|
90
|
-
'@typescript-eslint/switch-exhaustiveness-check': 'error',
|
|
91
|
-
'@typescript-eslint/type-annotation-spacing': 'error',
|
|
92
|
-
'@typescript-eslint/unified-signatures': 'error',
|
|
93
|
-
'no-shadow': 'off',
|
|
94
|
-
},
|
|
95
|
-
ignorePatterns: ['*.js'],
|
|
96
|
-
overrides: [
|
|
97
|
-
{
|
|
98
|
-
// put stricter rules you only want to apply to production code here
|
|
99
|
-
files: ['src/**'],
|
|
100
|
-
rules: {
|
|
101
|
-
'@typescript-eslint/restrict-template-expressions': [
|
|
102
|
-
'error',
|
|
103
|
-
{
|
|
104
|
-
allowNullish: false,
|
|
105
|
-
allowBoolean: true,
|
|
106
|
-
allowNumber: true,
|
|
107
|
-
},
|
|
108
|
-
],
|
|
109
|
-
'import/no-extraneous-dependencies': [
|
|
110
|
-
'error',
|
|
111
|
-
{
|
|
112
|
-
includeTypes: false,
|
|
113
|
-
devDependencies: false,
|
|
114
|
-
peerDependencies: false,
|
|
115
|
-
bundledDependencies: false,
|
|
116
|
-
optionalDependencies: false,
|
|
117
|
-
},
|
|
118
|
-
],
|
|
119
|
-
},
|
|
120
|
-
},
|
|
121
|
-
],
|
|
122
|
-
};
|