@rushstack/eslint-config 2.5.1 → 2.5.2
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/README.md +274 -274
- package/index.js +8 -8
- package/mixins/friendly-locals.js +85 -85
- package/mixins/packlets.js +21 -21
- package/mixins/react.js +77 -77
- package/mixins/tsdoc.js +20 -20
- package/package.json +46 -44
- package/patch/modern-module-resolution.js +4 -4
- package/patch-eslint6.js +8 -8
- package/profile/_common.js +837 -837
- package/profile/_macros.js +102 -102
- package/profile/node-trusted-tool.js +18 -18
- package/profile/node.js +11 -11
- package/profile/web-app.js +13 -13
- package/react.js +8 -8
- package/CHANGELOG.json +0 -833
- package/CHANGELOG.md +0 -374
package/profile/_macros.js
CHANGED
|
@@ -1,102 +1,102 @@
|
|
|
1
|
-
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
|
|
2
|
-
// See LICENSE in the project root for license information.
|
|
3
|
-
|
|
4
|
-
// This is a workaround for the @typescript-eslint/naming-convention rule, whose options currently
|
|
5
|
-
// support a "selector" field that cannot match multiple selectors. This function receives an input
|
|
6
|
-
// array such as:
|
|
7
|
-
//
|
|
8
|
-
// [
|
|
9
|
-
// {
|
|
10
|
-
// selectors: ['class', 'typeAlias', 'enum'],
|
|
11
|
-
// format: ['PascalCase']
|
|
12
|
-
// },
|
|
13
|
-
// . . .
|
|
14
|
-
// ]
|
|
15
|
-
//
|
|
16
|
-
// ...and transforms "selectors" -> "selector, returning an array with expanded entries like this:
|
|
17
|
-
//
|
|
18
|
-
// [
|
|
19
|
-
// {
|
|
20
|
-
// selector: 'class',
|
|
21
|
-
// format: ['PascalCase']
|
|
22
|
-
// },
|
|
23
|
-
// {
|
|
24
|
-
// selector: 'typeAlias',
|
|
25
|
-
// format: ['PascalCase']
|
|
26
|
-
// },
|
|
27
|
-
// {
|
|
28
|
-
// selector: 'enum',
|
|
29
|
-
// format: ['PascalCase']
|
|
30
|
-
// },
|
|
31
|
-
// . . .
|
|
32
|
-
// ]
|
|
33
|
-
//
|
|
34
|
-
// It also supports a "enforceLeadingUnderscoreWhenPrivate" macro that expands this:
|
|
35
|
-
//
|
|
36
|
-
// [
|
|
37
|
-
// {
|
|
38
|
-
// selectors: ['property'],
|
|
39
|
-
// enforceLeadingUnderscoreWhenPrivate: true,
|
|
40
|
-
// format: ['camelCase']
|
|
41
|
-
// },
|
|
42
|
-
// . . .
|
|
43
|
-
// ]
|
|
44
|
-
//
|
|
45
|
-
// ...to produce this:
|
|
46
|
-
//
|
|
47
|
-
// [
|
|
48
|
-
// {
|
|
49
|
-
// selector: 'property',
|
|
50
|
-
//
|
|
51
|
-
// leadingUnderscore: 'allow',
|
|
52
|
-
// format: ['camelCase']
|
|
53
|
-
// },
|
|
54
|
-
// {
|
|
55
|
-
// selector: 'property',
|
|
56
|
-
// modifiers: ['private'],
|
|
57
|
-
//
|
|
58
|
-
// leadingUnderscore: 'require',
|
|
59
|
-
// format: ['camelCase']
|
|
60
|
-
// },
|
|
61
|
-
// . . .
|
|
62
|
-
// ]
|
|
63
|
-
function expandNamingConventionSelectors(inputBlocks) {
|
|
64
|
-
const firstPassBlocks = [];
|
|
65
|
-
|
|
66
|
-
// Expand "selectors" --> "selector"
|
|
67
|
-
for (const block of inputBlocks) {
|
|
68
|
-
for (const selector of block.selectors) {
|
|
69
|
-
const expandedBlock = { ...block };
|
|
70
|
-
delete expandedBlock.selectors;
|
|
71
|
-
expandedBlock.selector = selector;
|
|
72
|
-
firstPassBlocks.push(expandedBlock);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
// Expand "enforceLeadingUnderscoreWhenPrivate" --> "leadingUnderscore"
|
|
77
|
-
const secondPassBlocks = [];
|
|
78
|
-
for (const block of firstPassBlocks) {
|
|
79
|
-
if (block.enforceLeadingUnderscoreWhenPrivate) {
|
|
80
|
-
const expandedBlock1 = {
|
|
81
|
-
...block,
|
|
82
|
-
leadingUnderscore: 'allow'
|
|
83
|
-
};
|
|
84
|
-
delete expandedBlock1.enforceLeadingUnderscoreWhenPrivate;
|
|
85
|
-
secondPassBlocks.push(expandedBlock1);
|
|
86
|
-
|
|
87
|
-
const expandedBlock2 = {
|
|
88
|
-
...block,
|
|
89
|
-
modifiers: ['private'],
|
|
90
|
-
leadingUnderscore: 'require'
|
|
91
|
-
};
|
|
92
|
-
delete expandedBlock2.enforceLeadingUnderscoreWhenPrivate;
|
|
93
|
-
secondPassBlocks.push(expandedBlock2);
|
|
94
|
-
} else {
|
|
95
|
-
secondPassBlocks.push(block);
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
return secondPassBlocks;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
exports.expandNamingConventionSelectors = expandNamingConventionSelectors;
|
|
1
|
+
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
|
|
2
|
+
// See LICENSE in the project root for license information.
|
|
3
|
+
|
|
4
|
+
// This is a workaround for the @typescript-eslint/naming-convention rule, whose options currently
|
|
5
|
+
// support a "selector" field that cannot match multiple selectors. This function receives an input
|
|
6
|
+
// array such as:
|
|
7
|
+
//
|
|
8
|
+
// [
|
|
9
|
+
// {
|
|
10
|
+
// selectors: ['class', 'typeAlias', 'enum'],
|
|
11
|
+
// format: ['PascalCase']
|
|
12
|
+
// },
|
|
13
|
+
// . . .
|
|
14
|
+
// ]
|
|
15
|
+
//
|
|
16
|
+
// ...and transforms "selectors" -> "selector, returning an array with expanded entries like this:
|
|
17
|
+
//
|
|
18
|
+
// [
|
|
19
|
+
// {
|
|
20
|
+
// selector: 'class',
|
|
21
|
+
// format: ['PascalCase']
|
|
22
|
+
// },
|
|
23
|
+
// {
|
|
24
|
+
// selector: 'typeAlias',
|
|
25
|
+
// format: ['PascalCase']
|
|
26
|
+
// },
|
|
27
|
+
// {
|
|
28
|
+
// selector: 'enum',
|
|
29
|
+
// format: ['PascalCase']
|
|
30
|
+
// },
|
|
31
|
+
// . . .
|
|
32
|
+
// ]
|
|
33
|
+
//
|
|
34
|
+
// It also supports a "enforceLeadingUnderscoreWhenPrivate" macro that expands this:
|
|
35
|
+
//
|
|
36
|
+
// [
|
|
37
|
+
// {
|
|
38
|
+
// selectors: ['property'],
|
|
39
|
+
// enforceLeadingUnderscoreWhenPrivate: true,
|
|
40
|
+
// format: ['camelCase']
|
|
41
|
+
// },
|
|
42
|
+
// . . .
|
|
43
|
+
// ]
|
|
44
|
+
//
|
|
45
|
+
// ...to produce this:
|
|
46
|
+
//
|
|
47
|
+
// [
|
|
48
|
+
// {
|
|
49
|
+
// selector: 'property',
|
|
50
|
+
//
|
|
51
|
+
// leadingUnderscore: 'allow',
|
|
52
|
+
// format: ['camelCase']
|
|
53
|
+
// },
|
|
54
|
+
// {
|
|
55
|
+
// selector: 'property',
|
|
56
|
+
// modifiers: ['private'],
|
|
57
|
+
//
|
|
58
|
+
// leadingUnderscore: 'require',
|
|
59
|
+
// format: ['camelCase']
|
|
60
|
+
// },
|
|
61
|
+
// . . .
|
|
62
|
+
// ]
|
|
63
|
+
function expandNamingConventionSelectors(inputBlocks) {
|
|
64
|
+
const firstPassBlocks = [];
|
|
65
|
+
|
|
66
|
+
// Expand "selectors" --> "selector"
|
|
67
|
+
for (const block of inputBlocks) {
|
|
68
|
+
for (const selector of block.selectors) {
|
|
69
|
+
const expandedBlock = { ...block };
|
|
70
|
+
delete expandedBlock.selectors;
|
|
71
|
+
expandedBlock.selector = selector;
|
|
72
|
+
firstPassBlocks.push(expandedBlock);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// Expand "enforceLeadingUnderscoreWhenPrivate" --> "leadingUnderscore"
|
|
77
|
+
const secondPassBlocks = [];
|
|
78
|
+
for (const block of firstPassBlocks) {
|
|
79
|
+
if (block.enforceLeadingUnderscoreWhenPrivate) {
|
|
80
|
+
const expandedBlock1 = {
|
|
81
|
+
...block,
|
|
82
|
+
leadingUnderscore: 'allow'
|
|
83
|
+
};
|
|
84
|
+
delete expandedBlock1.enforceLeadingUnderscoreWhenPrivate;
|
|
85
|
+
secondPassBlocks.push(expandedBlock1);
|
|
86
|
+
|
|
87
|
+
const expandedBlock2 = {
|
|
88
|
+
...block,
|
|
89
|
+
modifiers: ['private'],
|
|
90
|
+
leadingUnderscore: 'require'
|
|
91
|
+
};
|
|
92
|
+
delete expandedBlock2.enforceLeadingUnderscoreWhenPrivate;
|
|
93
|
+
secondPassBlocks.push(expandedBlock2);
|
|
94
|
+
} else {
|
|
95
|
+
secondPassBlocks.push(block);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
return secondPassBlocks;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
exports.expandNamingConventionSelectors = expandNamingConventionSelectors;
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
|
|
2
|
-
// See LICENSE in the project root for license information.
|
|
3
|
-
|
|
4
|
-
// This profile enables lint rules intended for a Node.js project whose inputs will always
|
|
5
|
-
// come from a developer or other trusted source. Most build system tasks are like this,
|
|
6
|
-
// since they operate on exclusively files prepared by a developer.
|
|
7
|
-
//
|
|
8
|
-
// This profile disables certain security rules that would otherwise prohibit APIs that could
|
|
9
|
-
// cause a denial-of-service by consuming too many resources, or which might interact with
|
|
10
|
-
// the filesystem in unsafe ways. Such activities are safe and commonplace for a trusted tool.
|
|
11
|
-
//
|
|
12
|
-
// DO NOT use this profile for a library project that might also be loaded by a Node.js service;
|
|
13
|
-
// use "@rushstack/eslint-config/profiles/node" instead.
|
|
14
|
-
|
|
15
|
-
const { buildRules } = require('./_common');
|
|
16
|
-
|
|
17
|
-
const rules = buildRules('node-trusted-tool');
|
|
18
|
-
module.exports = rules;
|
|
1
|
+
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
|
|
2
|
+
// See LICENSE in the project root for license information.
|
|
3
|
+
|
|
4
|
+
// This profile enables lint rules intended for a Node.js project whose inputs will always
|
|
5
|
+
// come from a developer or other trusted source. Most build system tasks are like this,
|
|
6
|
+
// since they operate on exclusively files prepared by a developer.
|
|
7
|
+
//
|
|
8
|
+
// This profile disables certain security rules that would otherwise prohibit APIs that could
|
|
9
|
+
// cause a denial-of-service by consuming too many resources, or which might interact with
|
|
10
|
+
// the filesystem in unsafe ways. Such activities are safe and commonplace for a trusted tool.
|
|
11
|
+
//
|
|
12
|
+
// DO NOT use this profile for a library project that might also be loaded by a Node.js service;
|
|
13
|
+
// use "@rushstack/eslint-config/profiles/node" instead.
|
|
14
|
+
|
|
15
|
+
const { buildRules } = require('./_common');
|
|
16
|
+
|
|
17
|
+
const rules = buildRules('node-trusted-tool');
|
|
18
|
+
module.exports = rules;
|
package/profile/node.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
|
|
2
|
-
// See LICENSE in the project root for license information.
|
|
3
|
-
|
|
4
|
-
// This profile enables lint rules intended for a general Node.js project, typically a web service.
|
|
5
|
-
// It enables security rules that assume the service could receive malicious inputs from an
|
|
6
|
-
// untrusted user. If that is not the case, consider using the "node-trusted-tool" profile instead.
|
|
7
|
-
|
|
8
|
-
const { buildRules } = require('./_common');
|
|
9
|
-
|
|
10
|
-
const rules = buildRules('node');
|
|
11
|
-
module.exports = rules;
|
|
1
|
+
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
|
|
2
|
+
// See LICENSE in the project root for license information.
|
|
3
|
+
|
|
4
|
+
// This profile enables lint rules intended for a general Node.js project, typically a web service.
|
|
5
|
+
// It enables security rules that assume the service could receive malicious inputs from an
|
|
6
|
+
// untrusted user. If that is not the case, consider using the "node-trusted-tool" profile instead.
|
|
7
|
+
|
|
8
|
+
const { buildRules } = require('./_common');
|
|
9
|
+
|
|
10
|
+
const rules = buildRules('node');
|
|
11
|
+
module.exports = rules;
|
package/profile/web-app.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
|
|
2
|
-
// See LICENSE in the project root for license information.
|
|
3
|
-
|
|
4
|
-
// This profile enables lint rules intended for a web application. It enables security rules
|
|
5
|
-
// that are relevant to web browser APIs such as DOM.
|
|
6
|
-
//
|
|
7
|
-
// Also use this profile if you are creating a library that can be consumed by both Node.js
|
|
8
|
-
// and web applications.
|
|
9
|
-
|
|
10
|
-
const { buildRules } = require('./_common');
|
|
11
|
-
|
|
12
|
-
const rules = buildRules('web-app');
|
|
13
|
-
module.exports = rules;
|
|
1
|
+
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
|
|
2
|
+
// See LICENSE in the project root for license information.
|
|
3
|
+
|
|
4
|
+
// This profile enables lint rules intended for a web application. It enables security rules
|
|
5
|
+
// that are relevant to web browser APIs such as DOM.
|
|
6
|
+
//
|
|
7
|
+
// Also use this profile if you are creating a library that can be consumed by both Node.js
|
|
8
|
+
// and web applications.
|
|
9
|
+
|
|
10
|
+
const { buildRules } = require('./_common');
|
|
11
|
+
|
|
12
|
+
const rules = buildRules('web-app');
|
|
13
|
+
module.exports = rules;
|
package/react.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
|
|
2
|
-
// See LICENSE in the project root for license information.
|
|
3
|
-
|
|
4
|
-
throw new Error(
|
|
5
|
-
'The react.js entry point has moved. Please update your ESLint configuration to reference' +
|
|
6
|
-
' "@rushstack/eslint-config/mixins/react" instead.' +
|
|
7
|
-
'\n\nSee the documentation for details: https://www.npmjs.com/package/@rushstack/eslint-config'
|
|
8
|
-
);
|
|
1
|
+
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
|
|
2
|
+
// See LICENSE in the project root for license information.
|
|
3
|
+
|
|
4
|
+
throw new Error(
|
|
5
|
+
'The react.js entry point has moved. Please update your ESLint configuration to reference' +
|
|
6
|
+
' "@rushstack/eslint-config/mixins/react" instead.' +
|
|
7
|
+
'\n\nSee the documentation for details: https://www.npmjs.com/package/@rushstack/eslint-config'
|
|
8
|
+
);
|