eslint-no-restricted 0.0.4
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/LICENSE +21 -0
- package/README.md +85 -0
- package/dist/globals.d.ts +18 -0
- package/dist/globals.js +64 -0
- package/dist/globals.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -0
- package/dist/properties.d.ts +30 -0
- package/dist/properties.js +130 -0
- package/dist/properties.js.map +1 -0
- package/dist/shared.d.ts +39 -0
- package/dist/shared.js +60 -0
- package/dist/shared.js.map +1 -0
- package/dist/syntax.d.ts +18 -0
- package/dist/syntax.js +50 -0
- package/dist/syntax.js.map +1 -0
- package/package.json +97 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Brad Zacher
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# eslint-no-restricted
|
|
2
|
+
|
|
3
|
+
An eslint utility for quickly and easily creating no-restricted-syntax rules.
|
|
4
|
+
|
|
5
|
+
This utility is a more powerful alternative to the core rules [`no-restricted-syntax`](https://eslint.org/docs/latest/rules/no-restricted-syntax), [`no-restricted-globals`](https://eslint.org/docs/latest/rules/no-restricted-globals), and [`no-restricted-properties`](https://eslint.org/docs/latest/rules/no-restricted-properties).
|
|
6
|
+
|
|
7
|
+
There are two major features you get with this utility over the core rules:
|
|
8
|
+
|
|
9
|
+
(1) This utility creates one rule per selector/global/property, rather than having one rule for everything.
|
|
10
|
+
Having multiple rules is useful for many reasons! It allows you to:
|
|
11
|
+
|
|
12
|
+
- Configure each selector/global/property with a different severity
|
|
13
|
+
- Easily enable or disable specific selector/global/property on specific files/folders
|
|
14
|
+
- Ensure that one disable comment does not suppress multiple selector/global/property
|
|
15
|
+
|
|
16
|
+
(2) This utility allows you to create messages with placeholders.
|
|
17
|
+
This is powerful because it allows you to provide more targeted, less generic messages to provide a better and more understandable DevX.
|
|
18
|
+
|
|
19
|
+
## Installation
|
|
20
|
+
|
|
21
|
+
```sh
|
|
22
|
+
npm i eslint-no-restricted
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Example Usage
|
|
26
|
+
|
|
27
|
+
For brevity following example shows usage of the `no-restricted-syntax` utility - but the same API is available for the `globals` and `properties` variants too.
|
|
28
|
+
|
|
29
|
+
```ts
|
|
30
|
+
// eslint.config.mjs
|
|
31
|
+
|
|
32
|
+
import createNoRestrictedSyntax from 'eslint-no-restricted/syntax';
|
|
33
|
+
|
|
34
|
+
const noRestrictedSyntax = createNoRestrictedSyntax(
|
|
35
|
+
// define a single selector with a message
|
|
36
|
+
{
|
|
37
|
+
message: 'errors on identifiers named foo',
|
|
38
|
+
name: 'ban-the-name-foo',
|
|
39
|
+
selector: 'Identifier[name = "foo"]',
|
|
40
|
+
},
|
|
41
|
+
|
|
42
|
+
// define multiple selectors with the same message
|
|
43
|
+
{
|
|
44
|
+
message: 'errors on the string "bar"',
|
|
45
|
+
name: 'do-not-allow-the-string-bar',
|
|
46
|
+
selector: [
|
|
47
|
+
'Literal[value = "bar"]',
|
|
48
|
+
'TemplateLiteral[quasis.length = 1] > TemplateElement[value.cooked = "bar"]',
|
|
49
|
+
],
|
|
50
|
+
},
|
|
51
|
+
|
|
52
|
+
// define one or more selectors with a placeholder derived from the matched node
|
|
53
|
+
{
|
|
54
|
+
message: 'this message has a placeholder ->{{placeholder}}<-',
|
|
55
|
+
messageData: (node, sourceCode) => {
|
|
56
|
+
if (node.parent?.type === 'VariableDeclarator') {
|
|
57
|
+
return {
|
|
58
|
+
placeholder: sourceCode.getText(node.parent.id),
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
return {
|
|
62
|
+
placeholder: 'wtf',
|
|
63
|
+
};
|
|
64
|
+
},
|
|
65
|
+
name: 'disallow-the-number-1',
|
|
66
|
+
selector: 'Literal[value = 1]',
|
|
67
|
+
},
|
|
68
|
+
);
|
|
69
|
+
|
|
70
|
+
export default [
|
|
71
|
+
// turn on all of the rules using the auto-generated configuration
|
|
72
|
+
noRestrictedSyntax.configs.recommended,
|
|
73
|
+
|
|
74
|
+
// you can also manually configure the rules
|
|
75
|
+
{
|
|
76
|
+
files: ['**/some-glob/*.js'],
|
|
77
|
+
plugins: {
|
|
78
|
+
nrs: noRestrictedSyntax,
|
|
79
|
+
},
|
|
80
|
+
rules: {
|
|
81
|
+
'nrs/disallow-the-number-1': 'off',
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
];
|
|
85
|
+
```
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Plugin } from './shared';
|
|
2
|
+
import * as shared from './shared';
|
|
3
|
+
import type { TSESTree } from '@typescript-eslint/utils';
|
|
4
|
+
declare namespace create {
|
|
5
|
+
interface RuleConfig extends shared.RuleBase<TSESTree.Identifier | TSESTree.JSXIdentifier> {
|
|
6
|
+
/**
|
|
7
|
+
* The global name to match
|
|
8
|
+
*
|
|
9
|
+
* You may pass multiple globals with an array for convenience rather than
|
|
10
|
+
* trying to merge multiple globals into one, or declaring the same message
|
|
11
|
+
* multiple times with different globals.
|
|
12
|
+
*/
|
|
13
|
+
globalName: Array<string> | string;
|
|
14
|
+
}
|
|
15
|
+
type CreateFn = typeof create;
|
|
16
|
+
}
|
|
17
|
+
declare function create(...rules: Array<create.RuleConfig>): Plugin;
|
|
18
|
+
export = create;
|
package/dist/globals.js
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
const shared = __importStar(require("./shared"));
|
|
26
|
+
function createRule(config) {
|
|
27
|
+
return function create(context) {
|
|
28
|
+
const globalNames = Array.isArray(config.globalName)
|
|
29
|
+
? config.globalName
|
|
30
|
+
: [config.globalName];
|
|
31
|
+
const sourceCode = context.sourceCode;
|
|
32
|
+
function reportReference(reference) {
|
|
33
|
+
context.report({
|
|
34
|
+
data: config.messageData == null
|
|
35
|
+
? {}
|
|
36
|
+
: config.messageData(reference.identifier, sourceCode),
|
|
37
|
+
messageId: 'report',
|
|
38
|
+
node: reference.identifier,
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
return {
|
|
42
|
+
Program(node) {
|
|
43
|
+
const scope = sourceCode.getScope(node);
|
|
44
|
+
// Report variables declared elsewhere (ex: variables defined as "global" by eslint)
|
|
45
|
+
scope.variables.forEach(variable => {
|
|
46
|
+
if (!variable.defs.length && globalNames.includes(variable.name)) {
|
|
47
|
+
variable.references.forEach(reportReference);
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
// Report variables not declared at all
|
|
51
|
+
scope.through.forEach(reference => {
|
|
52
|
+
if (globalNames.includes(reference.identifier.name)) {
|
|
53
|
+
reportReference(reference);
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
function create(...rules) {
|
|
61
|
+
return shared.createPlugin('globals', rules, createRule);
|
|
62
|
+
}
|
|
63
|
+
module.exports = create;
|
|
64
|
+
//# sourceMappingURL=globals.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"globals.js","sourceRoot":"","sources":["../src/globals.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AACA,iDAAmC;AAkBnC,SAAS,UAAU,CAAC,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,CAAC,CAAC;AACJ,CAAC;AAED,SAAS,MAAM,CAAC,GAAG,KAA+B;IAChD,OAAO,MAAM,CAAC,YAAY,CAAC,SAAS,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC;AAC3D,CAAC;AAED,iBAAS,MAAM,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import globals = require('./globals.js');
|
|
2
|
+
import properties = require('./properties.js');
|
|
3
|
+
import syntax = require('./syntax.js');
|
|
4
|
+
declare const exprt: {
|
|
5
|
+
createGlobals: globals.CreateFn;
|
|
6
|
+
createProperties: properties.CreateFn;
|
|
7
|
+
createSyntax: syntax.CreateFn;
|
|
8
|
+
};
|
|
9
|
+
export = exprt;
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const globals = require("./globals.js");
|
|
3
|
+
const properties = require("./properties.js");
|
|
4
|
+
const syntax = require("./syntax.js");
|
|
5
|
+
const exprt = {
|
|
6
|
+
createGlobals: globals,
|
|
7
|
+
createProperties: properties,
|
|
8
|
+
createSyntax: syntax,
|
|
9
|
+
};
|
|
10
|
+
module.exports = exprt;
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,wCAAyC;AACzC,8CAA+C;AAC/C,sCAAuC;AAEvC,MAAM,KAAK,GAIP;IACF,aAAa,EAAE,OAAO;IACtB,gBAAgB,EAAE,UAAU;IAC5B,YAAY,EAAE,MAAM;CACrB,CAAC;AACF,iBAAS,KAAK,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { Plugin } from './shared';
|
|
2
|
+
import * as shared from './shared';
|
|
3
|
+
import type { TSESTree } from '@typescript-eslint/utils';
|
|
4
|
+
declare namespace create {
|
|
5
|
+
interface RestrictedProperty {
|
|
6
|
+
/**
|
|
7
|
+
* The object name to ban from `object.property`. This is optional; if it is
|
|
8
|
+
* not provided then the `property` is disallowed for all objects.
|
|
9
|
+
*/
|
|
10
|
+
object?: string;
|
|
11
|
+
/**
|
|
12
|
+
* The property name to ban from `object.property`.
|
|
13
|
+
* If `object` is not provided then this is disallowed for all objects.
|
|
14
|
+
*/
|
|
15
|
+
property: string;
|
|
16
|
+
}
|
|
17
|
+
interface RuleConfig extends shared.RuleBase<TSESTree.MemberExpression | TSESTree.ObjectPattern> {
|
|
18
|
+
/**
|
|
19
|
+
* The properties name to match
|
|
20
|
+
*
|
|
21
|
+
* You may pass multiple properties with an array for convenience rather
|
|
22
|
+
* than trying to merge multiple properties into one, or declaring the same
|
|
23
|
+
* message multiple times with different properties.
|
|
24
|
+
*/
|
|
25
|
+
property: Array<RestrictedProperty> | RestrictedProperty;
|
|
26
|
+
}
|
|
27
|
+
type CreateFn = typeof create;
|
|
28
|
+
}
|
|
29
|
+
declare function create(...rules: Array<create.RuleConfig>): Plugin;
|
|
30
|
+
export = create;
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
const shared = __importStar(require("./shared"));
|
|
26
|
+
const utils_1 = require("@typescript-eslint/utils");
|
|
27
|
+
function getStaticStringValue(node) {
|
|
28
|
+
switch (node.type) {
|
|
29
|
+
case utils_1.AST_NODE_TYPES.Literal:
|
|
30
|
+
if (node.value === null) {
|
|
31
|
+
if ('regex' in node) {
|
|
32
|
+
return `/${node.regex.pattern}/${node.regex.flags}`;
|
|
33
|
+
}
|
|
34
|
+
if ('bigint' in node) {
|
|
35
|
+
return node.bigint;
|
|
36
|
+
}
|
|
37
|
+
return 'null';
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
return String(node.value);
|
|
41
|
+
}
|
|
42
|
+
case utils_1.AST_NODE_TYPES.TemplateLiteral:
|
|
43
|
+
if (node.expressions.length === 0 && node.quasis.length === 1) {
|
|
44
|
+
return node.quasis[0].value.cooked;
|
|
45
|
+
}
|
|
46
|
+
break;
|
|
47
|
+
}
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
function getStaticPropertyName(node) {
|
|
51
|
+
if (node?.type === utils_1.AST_NODE_TYPES.MemberExpression) {
|
|
52
|
+
if (node.property.type === utils_1.AST_NODE_TYPES.Identifier && !node.computed) {
|
|
53
|
+
return node.property.name;
|
|
54
|
+
}
|
|
55
|
+
return getStaticStringValue(node.property);
|
|
56
|
+
}
|
|
57
|
+
return null;
|
|
58
|
+
}
|
|
59
|
+
function createRule(config) {
|
|
60
|
+
return function create(context) {
|
|
61
|
+
const properties = Array.isArray(config.property)
|
|
62
|
+
? config.property
|
|
63
|
+
: [config.property];
|
|
64
|
+
const sourceCode = context.sourceCode;
|
|
65
|
+
const restrictedProperties = new Map();
|
|
66
|
+
const globallyRestrictedProperties = new Set();
|
|
67
|
+
properties.forEach(option => {
|
|
68
|
+
const objectName = option.object;
|
|
69
|
+
const propertyName = option.property;
|
|
70
|
+
if (objectName == null) {
|
|
71
|
+
globallyRestrictedProperties.add(propertyName);
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
if (!restrictedProperties.has(objectName)) {
|
|
75
|
+
restrictedProperties.set(objectName, new Set());
|
|
76
|
+
}
|
|
77
|
+
restrictedProperties.get(objectName)?.add(propertyName);
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
/**
|
|
81
|
+
* Checks to see whether a property access is restricted, and reports it if so.
|
|
82
|
+
*/
|
|
83
|
+
function checkPropertyAccess(node, objectName, propertyName) {
|
|
84
|
+
if (propertyName == null) {
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
const matchedObject = objectName && restrictedProperties.get(objectName);
|
|
88
|
+
const matchedObjectProperty = matchedObject && matchedObject.has(propertyName);
|
|
89
|
+
const globalMatchedProperty = globallyRestrictedProperties.has(propertyName);
|
|
90
|
+
if (matchedObjectProperty || globalMatchedProperty) {
|
|
91
|
+
context.report({
|
|
92
|
+
data: config.messageData == null
|
|
93
|
+
? {}
|
|
94
|
+
: config.messageData(node, sourceCode),
|
|
95
|
+
messageId: 'report',
|
|
96
|
+
node,
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return {
|
|
101
|
+
MemberExpression(node) {
|
|
102
|
+
checkPropertyAccess(node, node.object.type === utils_1.AST_NODE_TYPES.Identifier
|
|
103
|
+
? node.object.name
|
|
104
|
+
: undefined, getStaticPropertyName(node));
|
|
105
|
+
},
|
|
106
|
+
ObjectPattern(node) {
|
|
107
|
+
let objectName = null;
|
|
108
|
+
if (node.parent.type === utils_1.AST_NODE_TYPES.VariableDeclarator) {
|
|
109
|
+
if (node.parent.init?.type === utils_1.AST_NODE_TYPES.Identifier) {
|
|
110
|
+
objectName = node.parent.init.name;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
else if (node.parent.type === utils_1.AST_NODE_TYPES.AssignmentExpression ||
|
|
114
|
+
node.parent.type === utils_1.AST_NODE_TYPES.AssignmentPattern) {
|
|
115
|
+
if (node.parent.right.type === utils_1.AST_NODE_TYPES.Identifier) {
|
|
116
|
+
objectName = node.parent.right.name;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
node.properties.forEach(property => {
|
|
120
|
+
checkPropertyAccess(node, objectName, getStaticPropertyName(property));
|
|
121
|
+
});
|
|
122
|
+
},
|
|
123
|
+
};
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
function create(...rules) {
|
|
127
|
+
return shared.createPlugin('globals', rules, createRule);
|
|
128
|
+
}
|
|
129
|
+
module.exports = create;
|
|
130
|
+
//# sourceMappingURL=properties.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"properties.js","sourceRoot":"","sources":["../src/properties.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AACA,iDAAmC;AAEnC,oDAA0D;AA+B1D,SAAS,oBAAoB,CAAC,IAAmB;IAC/C,QAAQ,IAAI,CAAC,IAAI,EAAE,CAAC;QAClB,KAAK,sBAAc,CAAC,OAAO;YACzB,IAAI,IAAI,CAAC,KAAK,KAAK,IAAI,EAAE,CAAC;gBACxB,IAAI,OAAO,IAAI,IAAI,EAAE,CAAC;oBACpB,OAAO,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,IAAI,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;gBACtD,CAAC;gBACD,IAAI,QAAQ,IAAI,IAAI,EAAE,CAAC;oBACrB,OAAO,IAAI,CAAC,MAAM,CAAC;gBACrB,CAAC;gBACD,OAAO,MAAM,CAAC;YAChB,CAAC;iBAAM,CAAC;gBACN,OAAO,M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int, TSESTree } from '@typescript-eslint/utils';
|
|
2
|
+
export interface WithLoc {
|
|
3
|
+
loc: TSESTree.SourceLocation;
|
|
4
|
+
}
|
|
5
|
+
export interface RuleBase<TNode> {
|
|
6
|
+
/**
|
|
7
|
+
* The level to use for the rule in the generated "recommended" config
|
|
8
|
+
* @default 'error'
|
|
9
|
+
*/
|
|
10
|
+
defaultLevel?: 'error' | 'off' | 'warn';
|
|
11
|
+
/**
|
|
12
|
+
* A URL for more information
|
|
13
|
+
*/
|
|
14
|
+
docUrl?: string;
|
|
15
|
+
/**
|
|
16
|
+
* The message to display when reporting the error. You may define
|
|
17
|
+
* placeholders in the message and use `messageData` to fill in the data for
|
|
18
|
+
* the report.
|
|
19
|
+
*/
|
|
20
|
+
message: string;
|
|
21
|
+
/**
|
|
22
|
+
* An optional function that can be used to generate message placeholders
|
|
23
|
+
* {@link https://eslint.org/docs/latest/extend/custom-rules#using-message-placeholders}
|
|
24
|
+
*/
|
|
25
|
+
messageData?(node: TNode, sourceCode: TSESLint.SourceCode): Record<string, number | string>;
|
|
26
|
+
/**
|
|
27
|
+
* The name of the rule -- must be a kebab-cased-name
|
|
28
|
+
*/
|
|
29
|
+
name: string;
|
|
30
|
+
}
|
|
31
|
+
export interface Plugin {
|
|
32
|
+
configs: {
|
|
33
|
+
recommended: TSESLint.FlatConfig.Config;
|
|
34
|
+
};
|
|
35
|
+
meta: NonNullable<TSESLint.FlatConfig.Plugin['meta']>;
|
|
36
|
+
rules: NonNullable<TSESLint.FlatConfig.Plugin['rules']>;
|
|
37
|
+
}
|
|
38
|
+
export type RuleCreateFunction = TSESLint.RuleCreateFunction<'report', []>;
|
|
39
|
+
export declare function createPlugin<TNode, TConfig extends RuleBase<TNode>>(pluginName: 'globals' | 'properties' | 'syntax', rules: Array<TConfig>, createRule: (config: TConfig) => RuleCreateFunction): Plugin;
|
package/dist/shared.js
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createPlugin = createPlugin;
|
|
4
|
+
const utils_1 = require("@typescript-eslint/utils");
|
|
5
|
+
// note - cannot migrate this to an import statement because it will make TSC copy the package.json to the dist folder
|
|
6
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
|
|
7
|
+
const packageVersion = require('../package.json').version;
|
|
8
|
+
function createPlugin(pluginName, rules, createRule) {
|
|
9
|
+
const pluginPrefix = `no-restricted-${pluginName}`;
|
|
10
|
+
const plugin = {
|
|
11
|
+
configs: {
|
|
12
|
+
recommended: {
|
|
13
|
+
name: `no-restricted-${pluginName}/recommended`,
|
|
14
|
+
plugins: {
|
|
15
|
+
// assigned below to maintain plugin referential equality
|
|
16
|
+
},
|
|
17
|
+
rules: Object.fromEntries(rules
|
|
18
|
+
.filter(config => config.defaultLevel !== 'off')
|
|
19
|
+
.map(config => [
|
|
20
|
+
`${pluginPrefix}/${config.name}`,
|
|
21
|
+
config.defaultLevel ?? 'error',
|
|
22
|
+
])),
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
meta: {
|
|
26
|
+
name: `no-restricted-${pluginName}`,
|
|
27
|
+
version: packageVersion,
|
|
28
|
+
},
|
|
29
|
+
rules: Object.fromEntries(rules.map(config => {
|
|
30
|
+
if (config.message.includes('{{') &&
|
|
31
|
+
config.message.includes('}}') &&
|
|
32
|
+
!config.messageData) {
|
|
33
|
+
throw new Error(`Rule '${config.name}' defined a message with a {{placeholder}} but did not provide a \`messageData\` function.\nYou must provide a \`messageData\` function.`);
|
|
34
|
+
}
|
|
35
|
+
return [
|
|
36
|
+
config.name,
|
|
37
|
+
utils_1.ESLintUtils.RuleCreator.withoutDocs({
|
|
38
|
+
create: createRule(config),
|
|
39
|
+
defaultOptions: [],
|
|
40
|
+
meta: {
|
|
41
|
+
docs: {
|
|
42
|
+
description: config.message,
|
|
43
|
+
url: config.docUrl,
|
|
44
|
+
},
|
|
45
|
+
messages: {
|
|
46
|
+
report: config.message,
|
|
47
|
+
},
|
|
48
|
+
schema: [],
|
|
49
|
+
type: 'problem',
|
|
50
|
+
},
|
|
51
|
+
}),
|
|
52
|
+
];
|
|
53
|
+
})),
|
|
54
|
+
};
|
|
55
|
+
plugin.configs.recommended.plugins = {
|
|
56
|
+
[pluginPrefix]: plugin,
|
|
57
|
+
};
|
|
58
|
+
return plugin;
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=shared.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../src/shared.ts"],"names":[],"mappings":";;AAiDA,oCAiEC;AAjHD,oDAAuD;AA2CvD,sHAAsH;AACtH,+GAA+G;AAC/G,MAAM,cAAc,GAAW,OAAO,CAAC,iBAAiB,CAAC,CAAC,OAAO,CAAC;AAGlE,SAAgB,YAAY,CAC1B,UAA+C,EAC/C,KAAqB,EACrB,UAAmD;IAEnD,MAAM,YAAY,GAAG,iBAAiB,UAAU,EAAE,CAAC;IACnD,MAAM,MAAM,GAAG;QACb,OAAO,EAAE;YACP,WAAW,EAAE;gBACX,IAAI,EAAE,iBAAiB,UAAU,cAAc;gBAC/C,OAAO,EAAE;gBACP,yDAAyD;iBAC1D;gBACD,KAAK,EAAE,MAAM,CAAC,WAAW,CACvB,KAAK;qBACF,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,YAAY,KAAK,KAAK,CAAC;qBAC/C,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC;oBACb,GAAG,YAAY,IAAI,MAAM,CAAC,IAAI,EAAE;oBAChC,MAAM,CAAC,YAAY,IAAI,OAAO;iBAC/B,CAAC,CACL;aACF;SACF;QACD,IAAI,EAAE;YACJ,IAAI,EAAE,iBAAiB,UAAU,EAAE;YACnC,OAAO,EAAE,cAAc;SACxB;QACD,KAAK,EAAE,MAAM,CAAC,WAAW,CACvB,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE;YACjB,IACE,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC;gBAC7B,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC;gBAC7B,CAAC,MAAM,CAAC,WAAW,EACnB,CAAC;gBACD,MAAM,IAAI,KAAK,CACb,SAAS,MAAM,CAAC,IAAI,0IAA0I,CAC/J,CAAC;YACJ,CAAC;YAED,OAAO;gBACL,MAAM,CAAC,IAAI;gBACX,mBAAW,CAAC,WAAW,CAAC,WAAW,CAAC;oBAClC,MAAM,EAAE,UAAU,CAAC,MAAM,CAAC;oBAC1B,cAAc,EAAE,EAAE;oBAClB,IAAI,EAAE;wBACJ,IAAI,EAAE;4BACJ,WAAW,EAAE,MAAM,CAAC,OAAO;4BAC3B,GAAG,EAAE,MAAM,CAAC,MAAM;yBACnB;wBACD,QAAQ,EAAE;4BACR,MAAM,EAAE,MAAM,CAAC,OAAO;yBACvB;wBACD,MAAM,EAAE,EAAE;wBACV,IAAI,EAAE,SAAS;qBAChB;iBACF,CAAC;aACH,CAAC;QACJ,CAAC,CAAC,CACH;KACF,CAAC;IACF,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,OAAO,GAAG;QACnC,CAAC,YAAY,CAAC,EAAE,MAAM;KACvB,CAAC;IAEF,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/dist/syntax.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Plugin } from './shared';
|
|
2
|
+
import * as shared from './shared';
|
|
3
|
+
declare namespace create {
|
|
4
|
+
interface RuleConfig extends shared.RuleBase<unknown> {
|
|
5
|
+
/**
|
|
6
|
+
* The ESQuery selector to match
|
|
7
|
+
* {@link https://eslint.org/docs/latest/extend/selectors}
|
|
8
|
+
*
|
|
9
|
+
* You may pass multiple selectors with an array for convenience rather than
|
|
10
|
+
* trying to merge multiple selectors into one, or declaring the same message
|
|
11
|
+
* multiple times with slightly different selectors.
|
|
12
|
+
*/
|
|
13
|
+
selector: Array<string> | string;
|
|
14
|
+
}
|
|
15
|
+
type CreateFn = typeof create;
|
|
16
|
+
}
|
|
17
|
+
declare function create(...rules: Array<create.RuleConfig>): Plugin;
|
|
18
|
+
export = create;
|
package/dist/syntax.js
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
const shared = __importStar(require("./shared"));
|
|
26
|
+
function createRule(config) {
|
|
27
|
+
return function create(context) {
|
|
28
|
+
const selectors = Array.isArray(config.selector)
|
|
29
|
+
? config.selector
|
|
30
|
+
: [config.selector];
|
|
31
|
+
const sourceCode = context.sourceCode;
|
|
32
|
+
return Object.fromEntries(selectors.map(selector => [
|
|
33
|
+
selector,
|
|
34
|
+
(node) => {
|
|
35
|
+
context.report({
|
|
36
|
+
data: config.messageData == null
|
|
37
|
+
? {}
|
|
38
|
+
: config.messageData(node, sourceCode),
|
|
39
|
+
loc: node.loc,
|
|
40
|
+
messageId: 'report',
|
|
41
|
+
});
|
|
42
|
+
},
|
|
43
|
+
]));
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
function create(...rules) {
|
|
47
|
+
return shared.createPlugin('syntax', rules, createRule);
|
|
48
|
+
}
|
|
49
|
+
module.exports = create;
|
|
50
|
+
//# sourceMappingURL=syntax.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"syntax.js","sourceRoot":"","sources":["../src/syntax.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AACA,iDAAmC;AAiBnC,SAAS,UAAU,CAAC,MAAyB;IAC3C,OAAO,SAAS,MAAM,CAAC,OAAO;QAC5B,MAAM,SAAS,GAAG,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC;YAC9C,CAAC,CAAC,MAAM,CAAC,QAAQ;YACjB,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QACtB,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;QAEtC,OAAO,MAAM,CAAC,WAAW,CACvB,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC;YACxB,QAAQ;YACR,CAAC,IAAa,EAAE,EAAE;gBAChB,OAAO,CAAC,MAAM,CAAC;oBACb,IAAI,EACF,MAAM,CAAC,WAAW,IAAI,IAAI;wBACxB,CAAC,CAAC,EAAE;wBACJ,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,EAAE,UAAU,CAAC;oBAC1C,GAAG,EAAE,IAAI,CAAC,GAAG;oBACb,SAAS,EAAE,QAAQ;iBACpB,CAAC,CAAC;YACL,CAAC;SACF,CAAC,CACH,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC;AAED,SAAS,MAAM,CAAC,GAAG,KAA+B;IAChD,OAAO,MAAM,CAAC,YAAY,CAAC,QAAQ,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC;AAC1D,CAAC;AAED,iBAAS,MAAM,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "eslint-no-restricted",
|
|
3
|
+
"version": "0.0.4",
|
|
4
|
+
"keywords": [
|
|
5
|
+
"eslint"
|
|
6
|
+
],
|
|
7
|
+
"homepage": "https://github.com/bradzacher/eslint-no-restricted",
|
|
8
|
+
"bugs": {
|
|
9
|
+
"url": "https://github.com/bradzacher/eslint-no-restricted/issues"
|
|
10
|
+
},
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "git+https://github.com/bradzacher/eslint-no-restricted.git"
|
|
14
|
+
},
|
|
15
|
+
"funding": {
|
|
16
|
+
"type": "individual",
|
|
17
|
+
"url": "https://github.com/sponsors/bradzacher/"
|
|
18
|
+
},
|
|
19
|
+
"license": "MIT",
|
|
20
|
+
"contributors": [
|
|
21
|
+
"Brad Zacher <brad.zacher@gmail.com>"
|
|
22
|
+
],
|
|
23
|
+
"type": "commonjs",
|
|
24
|
+
"exports": {
|
|
25
|
+
".": {
|
|
26
|
+
"types": "./dist/index.d.ts",
|
|
27
|
+
"default": "./dist/index.js"
|
|
28
|
+
},
|
|
29
|
+
"./globals": {
|
|
30
|
+
"types": "./dist/globals.d.ts",
|
|
31
|
+
"default": "./dist/globals.js"
|
|
32
|
+
},
|
|
33
|
+
"./properties": {
|
|
34
|
+
"types": "./dist/properties.d.ts",
|
|
35
|
+
"default": "./dist/properties.js"
|
|
36
|
+
},
|
|
37
|
+
"./syntax": {
|
|
38
|
+
"types": "./dist/syntax.d.ts",
|
|
39
|
+
"default": "./dist/syntax.js"
|
|
40
|
+
},
|
|
41
|
+
"./package.json": "./package.json"
|
|
42
|
+
},
|
|
43
|
+
"types": "./dist/index.d.ts",
|
|
44
|
+
"files": [
|
|
45
|
+
"dist",
|
|
46
|
+
"package.json",
|
|
47
|
+
"README.md",
|
|
48
|
+
"LICENSE"
|
|
49
|
+
],
|
|
50
|
+
"scripts": {
|
|
51
|
+
"build": "rimraf dist .build.tsbuildinfo && tsc --project tsconfig.build.json",
|
|
52
|
+
"ci": "pnpm run build && pnpm run typecheck && pnpm run lint && pnpm run lint:knip && pnpm run lint:format && pnpm run lint:spelling",
|
|
53
|
+
"format": "prettier --write .",
|
|
54
|
+
"lint": "eslint .",
|
|
55
|
+
"lint:attw": "attw",
|
|
56
|
+
"lint:format": "prettier --check .",
|
|
57
|
+
"lint:knip": "knip",
|
|
58
|
+
"lint:spelling": "cspell --config=.cspell.json \"**/*.{md,mdx,ts,mts,cts,js,cjs,mjs,tsx,jsx}\" --no-progress --show-context --show-suggestions",
|
|
59
|
+
"test": "vitest",
|
|
60
|
+
"typecheck": "tsc --project tsconfig.build.json --noEmit && tsc --project tsconfig.tools.json --noEmit && tsc --project tsconfig.test.json --noEmit"
|
|
61
|
+
},
|
|
62
|
+
"dependencies": {
|
|
63
|
+
"@arethetypeswrong/cli": "^0.16.4",
|
|
64
|
+
"@typescript-eslint/utils": "^8.13.0"
|
|
65
|
+
},
|
|
66
|
+
"devDependencies": {
|
|
67
|
+
"@eslint-community/eslint-plugin-eslint-comments": "^4.4.1",
|
|
68
|
+
"@eslint/js": "^9.14.0",
|
|
69
|
+
"@tsconfig/node20": "^20",
|
|
70
|
+
"@types/node": "^20",
|
|
71
|
+
"cspell": "^8.15.7",
|
|
72
|
+
"eslint": "^9.14.0",
|
|
73
|
+
"eslint-config-prettier": "^9.1.0",
|
|
74
|
+
"eslint-plugin-jsonc": "^2.16.0",
|
|
75
|
+
"eslint-plugin-markdown": "^5.1.0",
|
|
76
|
+
"eslint-plugin-n": "^17.12.0",
|
|
77
|
+
"eslint-plugin-package-json": "^0.15.4",
|
|
78
|
+
"eslint-plugin-perfectionist": "^3.9.1",
|
|
79
|
+
"eslint-plugin-regexp": "^2.6.0",
|
|
80
|
+
"eslint-plugin-yml": "^1.15.0",
|
|
81
|
+
"knip": "^5.36.2",
|
|
82
|
+
"prettier": "^3.3.3",
|
|
83
|
+
"prettier-plugin-curly": "^0.3.1",
|
|
84
|
+
"prettier-plugin-packagejson": "^2.5.3",
|
|
85
|
+
"prettier-plugin-sh": "^0.14.0",
|
|
86
|
+
"rimraf": "^6.0.1",
|
|
87
|
+
"typescript": "^5.6.3",
|
|
88
|
+
"typescript-eslint": "^8.13.0",
|
|
89
|
+
"vitest": "^2.1.4"
|
|
90
|
+
},
|
|
91
|
+
"peerDependencies": {
|
|
92
|
+
"eslint": "^8.57.0 || ^9"
|
|
93
|
+
},
|
|
94
|
+
"engines": {
|
|
95
|
+
"node": "^20.18.0 || >=22.0.0"
|
|
96
|
+
}
|
|
97
|
+
}
|