@microsoft/sp-tslint-rules 1.22.2 → 1.23.0-beta.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-commonjs/importRequiresChunkNameRule.js +10 -24
- package/lib-commonjs/noAsyncAwaitRule.js +10 -24
- package/lib-commonjs/noRequireEnsureRule.js +10 -24
- package/lib-commonjs/pairReactDomRenderUnmountRule.js +11 -28
- package/lib-commonjs/validKillSwitchGuidRule.js +10 -24
- package/lib-esm/importRequiresChunkNameRule.js +10 -24
- package/lib-esm/noAsyncAwaitRule.js +10 -24
- package/lib-esm/noRequireEnsureRule.js +10 -24
- package/lib-esm/pairReactDomRenderUnmountRule.js +11 -28
- package/lib-esm/validKillSwitchGuidRule.js +10 -24
- package/package.json +7 -7
|
@@ -11,19 +11,6 @@ Object.defineProperty(exports, "Rule", {
|
|
|
11
11
|
const _tsutils = require("tsutils");
|
|
12
12
|
const _typescript = /*#__PURE__*/ _interop_require_wildcard(require("typescript"));
|
|
13
13
|
const _tslint = /*#__PURE__*/ _interop_require_wildcard(require("tslint"));
|
|
14
|
-
function _define_property(obj, key, value) {
|
|
15
|
-
if (key in obj) {
|
|
16
|
-
Object.defineProperty(obj, key, {
|
|
17
|
-
value: value,
|
|
18
|
-
enumerable: true,
|
|
19
|
-
configurable: true,
|
|
20
|
-
writable: true
|
|
21
|
-
});
|
|
22
|
-
} else {
|
|
23
|
-
obj[key] = value;
|
|
24
|
-
}
|
|
25
|
-
return obj;
|
|
26
|
-
}
|
|
27
14
|
function _getRequireWildcardCache(nodeInterop) {
|
|
28
15
|
if (typeof WeakMap !== "function") return null;
|
|
29
16
|
var cacheBabelInterop = new WeakMap();
|
|
@@ -76,8 +63,16 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
76
63
|
* - propertyName :"value"
|
|
77
64
|
* - propertyName : "value"
|
|
78
65
|
*/ const COMMENT_PART_REGEX = /^([A-Za-z]+)\s*:\s*('[^']+'|"[^"]+")$/;
|
|
79
|
-
|
|
80
|
-
|
|
66
|
+
class Rule extends _tslint.Rules.AbstractRule {
|
|
67
|
+
static metadata = {
|
|
68
|
+
ruleName: 'import-requires-chunk-name',
|
|
69
|
+
description: 'Requires that calls to import(...) for code splitting include a webpack chunk name',
|
|
70
|
+
rationale: 'Unnamed chunks are difficult to manage.',
|
|
71
|
+
optionsDescription: 'No options available.',
|
|
72
|
+
options: {},
|
|
73
|
+
type: 'functionality',
|
|
74
|
+
typescriptOnly: false
|
|
75
|
+
};
|
|
81
76
|
apply(sourceFile) {
|
|
82
77
|
return this.applyWithFunction(sourceFile, (ctx)=>{
|
|
83
78
|
const childCallback = (node)=>{
|
|
@@ -117,14 +112,5 @@ class Rule extends (_Lint_Rules_AbstractRule = _tslint.Rules.AbstractRule) {
|
|
|
117
112
|
});
|
|
118
113
|
}
|
|
119
114
|
}
|
|
120
|
-
_define_property(Rule, "metadata", {
|
|
121
|
-
ruleName: 'import-requires-chunk-name',
|
|
122
|
-
description: 'Requires that calls to import(...) for code splitting include a webpack chunk name',
|
|
123
|
-
rationale: 'Unnamed chunks are difficult to manage.',
|
|
124
|
-
optionsDescription: 'No options available.',
|
|
125
|
-
options: {},
|
|
126
|
-
type: 'functionality',
|
|
127
|
-
typescriptOnly: false
|
|
128
|
-
});
|
|
129
115
|
|
|
130
116
|
//# sourceMappingURL=./importRequiresChunkNameRule.js.map
|
|
@@ -11,19 +11,6 @@ Object.defineProperty(exports, "Rule", {
|
|
|
11
11
|
const _tsutils = require("tsutils");
|
|
12
12
|
const _typescript = /*#__PURE__*/ _interop_require_wildcard(require("typescript"));
|
|
13
13
|
const _tslint = /*#__PURE__*/ _interop_require_wildcard(require("tslint"));
|
|
14
|
-
function _define_property(obj, key, value) {
|
|
15
|
-
if (key in obj) {
|
|
16
|
-
Object.defineProperty(obj, key, {
|
|
17
|
-
value: value,
|
|
18
|
-
enumerable: true,
|
|
19
|
-
configurable: true,
|
|
20
|
-
writable: true
|
|
21
|
-
});
|
|
22
|
-
} else {
|
|
23
|
-
obj[key] = value;
|
|
24
|
-
}
|
|
25
|
-
return obj;
|
|
26
|
-
}
|
|
27
14
|
function _getRequireWildcardCache(nodeInterop) {
|
|
28
15
|
if (typeof WeakMap !== "function") return null;
|
|
29
16
|
var cacheBabelInterop = new WeakMap();
|
|
@@ -65,21 +52,20 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
65
52
|
}
|
|
66
53
|
return newObj;
|
|
67
54
|
}
|
|
68
|
-
|
|
69
|
-
|
|
55
|
+
class Rule extends _tslint.Rules.AbstractRule {
|
|
56
|
+
static metadata = {
|
|
57
|
+
ruleName: 'no-async-await',
|
|
58
|
+
description: 'Warn when using async/await functions.',
|
|
59
|
+
rationale: 'async/await has overhead when emitting ES5 JavaScript',
|
|
60
|
+
optionsDescription: 'No options available.',
|
|
61
|
+
options: undefined,
|
|
62
|
+
type: 'functionality',
|
|
63
|
+
typescriptOnly: false
|
|
64
|
+
};
|
|
70
65
|
apply(source) {
|
|
71
66
|
return this.applyWithFunction(source, noAsyncAwait);
|
|
72
67
|
}
|
|
73
68
|
}
|
|
74
|
-
_define_property(Rule, "metadata", {
|
|
75
|
-
ruleName: 'no-async-await',
|
|
76
|
-
description: 'Warn when using async/await functions.',
|
|
77
|
-
rationale: 'async/await has overhead when emitting ES5 JavaScript',
|
|
78
|
-
optionsDescription: 'No options available.',
|
|
79
|
-
options: undefined,
|
|
80
|
-
type: 'functionality',
|
|
81
|
-
typescriptOnly: false
|
|
82
|
-
});
|
|
83
69
|
function noAsyncAwait(context, node) {
|
|
84
70
|
if (!node) {
|
|
85
71
|
_typescript.forEachChild(context.sourceFile, (n)=>noAsyncAwait(context, n));
|
|
@@ -11,19 +11,6 @@ Object.defineProperty(exports, "Rule", {
|
|
|
11
11
|
const _tsutils = require("tsutils");
|
|
12
12
|
const _typescript = /*#__PURE__*/ _interop_require_wildcard(require("typescript"));
|
|
13
13
|
const _tslint = /*#__PURE__*/ _interop_require_wildcard(require("tslint"));
|
|
14
|
-
function _define_property(obj, key, value) {
|
|
15
|
-
if (key in obj) {
|
|
16
|
-
Object.defineProperty(obj, key, {
|
|
17
|
-
value: value,
|
|
18
|
-
enumerable: true,
|
|
19
|
-
configurable: true,
|
|
20
|
-
writable: true
|
|
21
|
-
});
|
|
22
|
-
} else {
|
|
23
|
-
obj[key] = value;
|
|
24
|
-
}
|
|
25
|
-
return obj;
|
|
26
|
-
}
|
|
27
14
|
function _getRequireWildcardCache(nodeInterop) {
|
|
28
15
|
if (typeof WeakMap !== "function") return null;
|
|
29
16
|
var cacheBabelInterop = new WeakMap();
|
|
@@ -65,8 +52,16 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
65
52
|
}
|
|
66
53
|
return newObj;
|
|
67
54
|
}
|
|
68
|
-
|
|
69
|
-
|
|
55
|
+
class Rule extends _tslint.Rules.AbstractRule {
|
|
56
|
+
static metadata = {
|
|
57
|
+
ruleName: 'no-require-ensure',
|
|
58
|
+
description: 'Warns about the use of the require.ensure function.',
|
|
59
|
+
rationale: '`require.ensure` is outdated. Use `import(...)` instead.',
|
|
60
|
+
optionsDescription: 'No options available.',
|
|
61
|
+
options: {},
|
|
62
|
+
type: 'functionality',
|
|
63
|
+
typescriptOnly: false
|
|
64
|
+
};
|
|
70
65
|
apply(sourceFile) {
|
|
71
66
|
return this.applyWithFunction(sourceFile, (ctx)=>{
|
|
72
67
|
const childCallback = (node)=>{
|
|
@@ -82,14 +77,5 @@ class Rule extends (_Lint_Rules_AbstractRule = _tslint.Rules.AbstractRule) {
|
|
|
82
77
|
});
|
|
83
78
|
}
|
|
84
79
|
}
|
|
85
|
-
_define_property(Rule, "metadata", {
|
|
86
|
-
ruleName: 'no-require-ensure',
|
|
87
|
-
description: 'Warns about the use of the require.ensure function.',
|
|
88
|
-
rationale: '`require.ensure` is outdated. Use `import(...)` instead.',
|
|
89
|
-
optionsDescription: 'No options available.',
|
|
90
|
-
options: {},
|
|
91
|
-
type: 'functionality',
|
|
92
|
-
typescriptOnly: false
|
|
93
|
-
});
|
|
94
80
|
|
|
95
81
|
//# sourceMappingURL=./noRequireEnsureRule.js.map
|
|
@@ -11,19 +11,6 @@ Object.defineProperty(exports, "Rule", {
|
|
|
11
11
|
const _tsutils = /*#__PURE__*/ _interop_require_wildcard(require("tsutils"));
|
|
12
12
|
const _typescript = /*#__PURE__*/ _interop_require_wildcard(require("typescript"));
|
|
13
13
|
const _tslint = /*#__PURE__*/ _interop_require_wildcard(require("tslint"));
|
|
14
|
-
function _define_property(obj, key, value) {
|
|
15
|
-
if (key in obj) {
|
|
16
|
-
Object.defineProperty(obj, key, {
|
|
17
|
-
value: value,
|
|
18
|
-
enumerable: true,
|
|
19
|
-
configurable: true,
|
|
20
|
-
writable: true
|
|
21
|
-
});
|
|
22
|
-
} else {
|
|
23
|
-
obj[key] = value;
|
|
24
|
-
}
|
|
25
|
-
return obj;
|
|
26
|
-
}
|
|
27
14
|
function _getRequireWildcardCache(nodeInterop) {
|
|
28
15
|
if (typeof WeakMap !== "function") return null;
|
|
29
16
|
var cacheBabelInterop = new WeakMap();
|
|
@@ -65,8 +52,17 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
65
52
|
}
|
|
66
53
|
return newObj;
|
|
67
54
|
}
|
|
68
|
-
|
|
69
|
-
|
|
55
|
+
class Rule extends _tslint.Rules.AbstractRule {
|
|
56
|
+
static metadata = {
|
|
57
|
+
ruleName: 'pair-react-dom-render-unmount',
|
|
58
|
+
description: 'Pair ReactDOM render and unmount calls in one file.' + ' If a ReactDOM render tree is not unmounted when disposed, it will cause a memory leak.',
|
|
59
|
+
rationale: 'Pair the render and unmount calls to avoid memory leak.',
|
|
60
|
+
optionsDescription: 'No options available.',
|
|
61
|
+
options: {},
|
|
62
|
+
type: 'maintainability',
|
|
63
|
+
typescriptOnly: false
|
|
64
|
+
};
|
|
65
|
+
_reactDOMImportNamespaceName;
|
|
70
66
|
apply(sourceFile) {
|
|
71
67
|
return this.applyWithFunction(sourceFile, this._walk.bind(this));
|
|
72
68
|
}
|
|
@@ -118,19 +114,6 @@ class Rule extends (_Lint_Rules_AbstractRule = _tslint.Rules.AbstractRule) {
|
|
|
118
114
|
_tsutils.isIdentifier(node.expression.expression) && node.expression.expression.text === this._reactDOMImportNamespaceName && // method
|
|
119
115
|
_tsutils.isIdentifier(node.expression.name) && node.expression.name.text === methodName);
|
|
120
116
|
}
|
|
121
|
-
constructor(...args){
|
|
122
|
-
super(...args);
|
|
123
|
-
_define_property(this, "_reactDOMImportNamespaceName", void 0);
|
|
124
|
-
}
|
|
125
117
|
}
|
|
126
|
-
_define_property(Rule, "metadata", {
|
|
127
|
-
ruleName: 'pair-react-dom-render-unmount',
|
|
128
|
-
description: 'Pair ReactDOM render and unmount calls in one file.' + ' If a ReactDOM render tree is not unmounted when disposed, it will cause a memory leak.',
|
|
129
|
-
rationale: 'Pair the render and unmount calls to avoid memory leak.',
|
|
130
|
-
optionsDescription: 'No options available.',
|
|
131
|
-
options: {},
|
|
132
|
-
type: 'maintainability',
|
|
133
|
-
typescriptOnly: false
|
|
134
|
-
});
|
|
135
118
|
|
|
136
119
|
//# sourceMappingURL=./pairReactDomRenderUnmountRule.js.map
|
|
@@ -11,19 +11,6 @@ Object.defineProperty(exports, "Rule", {
|
|
|
11
11
|
const _tslint = /*#__PURE__*/ _interop_require_wildcard(require("tslint"));
|
|
12
12
|
const _tsutils = require("tsutils");
|
|
13
13
|
const _typescript = /*#__PURE__*/ _interop_require_wildcard(require("typescript"));
|
|
14
|
-
function _define_property(obj, key, value) {
|
|
15
|
-
if (key in obj) {
|
|
16
|
-
Object.defineProperty(obj, key, {
|
|
17
|
-
value: value,
|
|
18
|
-
enumerable: true,
|
|
19
|
-
configurable: true,
|
|
20
|
-
writable: true
|
|
21
|
-
});
|
|
22
|
-
} else {
|
|
23
|
-
obj[key] = value;
|
|
24
|
-
}
|
|
25
|
-
return obj;
|
|
26
|
-
}
|
|
27
14
|
function _getRequireWildcardCache(nodeInterop) {
|
|
28
15
|
if (typeof WeakMap !== "function") return null;
|
|
29
16
|
var cacheBabelInterop = new WeakMap();
|
|
@@ -65,21 +52,20 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
65
52
|
}
|
|
66
53
|
return newObj;
|
|
67
54
|
}
|
|
68
|
-
|
|
69
|
-
|
|
55
|
+
class Rule extends _tslint.Rules.AbstractRule {
|
|
56
|
+
static metadata = {
|
|
57
|
+
ruleName: 'valid-kill-switch-guid',
|
|
58
|
+
description: 'Warn if _SPKillSwitch.isActivated is being called with an incorrect argument',
|
|
59
|
+
rationale: 'Compile time type safety',
|
|
60
|
+
optionsDescription: 'No options available.',
|
|
61
|
+
options: undefined,
|
|
62
|
+
type: 'functionality',
|
|
63
|
+
typescriptOnly: false
|
|
64
|
+
};
|
|
70
65
|
apply(source) {
|
|
71
66
|
return this.applyWithFunction(source, validKillSwitchGuid);
|
|
72
67
|
}
|
|
73
68
|
}
|
|
74
|
-
_define_property(Rule, "metadata", {
|
|
75
|
-
ruleName: 'valid-kill-switch-guid',
|
|
76
|
-
description: 'Warn if _SPKillSwitch.isActivated is being called with an incorrect argument',
|
|
77
|
-
rationale: 'Compile time type safety',
|
|
78
|
-
optionsDescription: 'No options available.',
|
|
79
|
-
options: undefined,
|
|
80
|
-
type: 'functionality',
|
|
81
|
-
typescriptOnly: false
|
|
82
|
-
});
|
|
83
69
|
function validKillSwitchGuid(context, node) {
|
|
84
70
|
if (!node) {
|
|
85
71
|
_typescript.forEachChild(context.sourceFile, (n)=>validKillSwitchGuid(context, n));
|
|
@@ -1,16 +1,3 @@
|
|
|
1
|
-
function _define_property(obj, key, value) {
|
|
2
|
-
if (key in obj) {
|
|
3
|
-
Object.defineProperty(obj, key, {
|
|
4
|
-
value: value,
|
|
5
|
-
enumerable: true,
|
|
6
|
-
configurable: true,
|
|
7
|
-
writable: true
|
|
8
|
-
});
|
|
9
|
-
} else {
|
|
10
|
-
obj[key] = value;
|
|
11
|
-
}
|
|
12
|
-
return obj;
|
|
13
|
-
}
|
|
14
1
|
import { isCallExpression, forEachComment } from 'tsutils';
|
|
15
2
|
import * as ts from 'typescript';
|
|
16
3
|
import * as Lint from 'tslint';
|
|
@@ -25,12 +12,20 @@ import * as Lint from 'tslint';
|
|
|
25
12
|
* - propertyName :"value"
|
|
26
13
|
* - propertyName : "value"
|
|
27
14
|
*/ const COMMENT_PART_REGEX = /^([A-Za-z]+)\s*:\s*('[^']+'|"[^"]+")$/;
|
|
28
|
-
var _Lint_Rules_AbstractRule;
|
|
29
15
|
/**
|
|
30
16
|
* This rule requires that import(...) statements include a /* webpackChunkName: '...' *\/ comment.
|
|
31
17
|
*
|
|
32
18
|
* See documentation here: https://webpack.js.org/api/module-methods/#import-
|
|
33
|
-
*/ export class Rule extends
|
|
19
|
+
*/ export class Rule extends Lint.Rules.AbstractRule {
|
|
20
|
+
static metadata = {
|
|
21
|
+
ruleName: 'import-requires-chunk-name',
|
|
22
|
+
description: 'Requires that calls to import(...) for code splitting include a webpack chunk name',
|
|
23
|
+
rationale: 'Unnamed chunks are difficult to manage.',
|
|
24
|
+
optionsDescription: 'No options available.',
|
|
25
|
+
options: {},
|
|
26
|
+
type: 'functionality',
|
|
27
|
+
typescriptOnly: false
|
|
28
|
+
};
|
|
34
29
|
apply(sourceFile) {
|
|
35
30
|
return this.applyWithFunction(sourceFile, (ctx)=>{
|
|
36
31
|
const childCallback = (node)=>{
|
|
@@ -70,14 +65,5 @@ var _Lint_Rules_AbstractRule;
|
|
|
70
65
|
});
|
|
71
66
|
}
|
|
72
67
|
}
|
|
73
|
-
_define_property(Rule, "metadata", {
|
|
74
|
-
ruleName: 'import-requires-chunk-name',
|
|
75
|
-
description: 'Requires that calls to import(...) for code splitting include a webpack chunk name',
|
|
76
|
-
rationale: 'Unnamed chunks are difficult to manage.',
|
|
77
|
-
optionsDescription: 'No options available.',
|
|
78
|
-
options: {},
|
|
79
|
-
type: 'functionality',
|
|
80
|
-
typescriptOnly: false
|
|
81
|
-
});
|
|
82
68
|
|
|
83
69
|
//# sourceMappingURL=./importRequiresChunkNameRule.js.map
|
|
@@ -1,38 +1,24 @@
|
|
|
1
|
-
function _define_property(obj, key, value) {
|
|
2
|
-
if (key in obj) {
|
|
3
|
-
Object.defineProperty(obj, key, {
|
|
4
|
-
value: value,
|
|
5
|
-
enumerable: true,
|
|
6
|
-
configurable: true,
|
|
7
|
-
writable: true
|
|
8
|
-
});
|
|
9
|
-
} else {
|
|
10
|
-
obj[key] = value;
|
|
11
|
-
}
|
|
12
|
-
return obj;
|
|
13
|
-
}
|
|
14
1
|
import { isArrowFunction, isFunctionDeclaration, isFunctionExpression, isMethodDeclaration } from 'tsutils';
|
|
15
2
|
import * as ts from 'typescript';
|
|
16
3
|
import * as Lint from 'tslint';
|
|
17
|
-
var _Lint_Rules_AbstractRule;
|
|
18
4
|
/**
|
|
19
5
|
* Check for any functions with the `async` modifier. If a function does not have the `async`
|
|
20
6
|
* modifier then we defer to TSC to fail on `await` keywords since `await` has to be used
|
|
21
7
|
* within an `async` context.
|
|
22
|
-
*/ export class Rule extends
|
|
8
|
+
*/ export class Rule extends Lint.Rules.AbstractRule {
|
|
9
|
+
static metadata = {
|
|
10
|
+
ruleName: 'no-async-await',
|
|
11
|
+
description: 'Warn when using async/await functions.',
|
|
12
|
+
rationale: 'async/await has overhead when emitting ES5 JavaScript',
|
|
13
|
+
optionsDescription: 'No options available.',
|
|
14
|
+
options: undefined,
|
|
15
|
+
type: 'functionality',
|
|
16
|
+
typescriptOnly: false
|
|
17
|
+
};
|
|
23
18
|
apply(source) {
|
|
24
19
|
return this.applyWithFunction(source, noAsyncAwait);
|
|
25
20
|
}
|
|
26
21
|
}
|
|
27
|
-
_define_property(Rule, "metadata", {
|
|
28
|
-
ruleName: 'no-async-await',
|
|
29
|
-
description: 'Warn when using async/await functions.',
|
|
30
|
-
rationale: 'async/await has overhead when emitting ES5 JavaScript',
|
|
31
|
-
optionsDescription: 'No options available.',
|
|
32
|
-
options: undefined,
|
|
33
|
-
type: 'functionality',
|
|
34
|
-
typescriptOnly: false
|
|
35
|
-
});
|
|
36
22
|
function noAsyncAwait(context, node) {
|
|
37
23
|
if (!node) {
|
|
38
24
|
ts.forEachChild(context.sourceFile, (n)=>noAsyncAwait(context, n));
|
|
@@ -1,21 +1,16 @@
|
|
|
1
|
-
function _define_property(obj, key, value) {
|
|
2
|
-
if (key in obj) {
|
|
3
|
-
Object.defineProperty(obj, key, {
|
|
4
|
-
value: value,
|
|
5
|
-
enumerable: true,
|
|
6
|
-
configurable: true,
|
|
7
|
-
writable: true
|
|
8
|
-
});
|
|
9
|
-
} else {
|
|
10
|
-
obj[key] = value;
|
|
11
|
-
}
|
|
12
|
-
return obj;
|
|
13
|
-
}
|
|
14
1
|
import { isCallExpression, isIdentifier, isPropertyAccessExpression } from 'tsutils';
|
|
15
2
|
import * as ts from 'typescript';
|
|
16
3
|
import * as Lint from 'tslint';
|
|
17
|
-
|
|
18
|
-
|
|
4
|
+
export class Rule extends Lint.Rules.AbstractRule {
|
|
5
|
+
static metadata = {
|
|
6
|
+
ruleName: 'no-require-ensure',
|
|
7
|
+
description: 'Warns about the use of the require.ensure function.',
|
|
8
|
+
rationale: '`require.ensure` is outdated. Use `import(...)` instead.',
|
|
9
|
+
optionsDescription: 'No options available.',
|
|
10
|
+
options: {},
|
|
11
|
+
type: 'functionality',
|
|
12
|
+
typescriptOnly: false
|
|
13
|
+
};
|
|
19
14
|
apply(sourceFile) {
|
|
20
15
|
return this.applyWithFunction(sourceFile, (ctx)=>{
|
|
21
16
|
const childCallback = (node)=>{
|
|
@@ -31,14 +26,5 @@ export class Rule extends (_Lint_Rules_AbstractRule = Lint.Rules.AbstractRule) {
|
|
|
31
26
|
});
|
|
32
27
|
}
|
|
33
28
|
}
|
|
34
|
-
_define_property(Rule, "metadata", {
|
|
35
|
-
ruleName: 'no-require-ensure',
|
|
36
|
-
description: 'Warns about the use of the require.ensure function.',
|
|
37
|
-
rationale: '`require.ensure` is outdated. Use `import(...)` instead.',
|
|
38
|
-
optionsDescription: 'No options available.',
|
|
39
|
-
options: {},
|
|
40
|
-
type: 'functionality',
|
|
41
|
-
typescriptOnly: false
|
|
42
|
-
});
|
|
43
29
|
|
|
44
30
|
//# sourceMappingURL=./noRequireEnsureRule.js.map
|
|
@@ -1,21 +1,17 @@
|
|
|
1
|
-
function _define_property(obj, key, value) {
|
|
2
|
-
if (key in obj) {
|
|
3
|
-
Object.defineProperty(obj, key, {
|
|
4
|
-
value: value,
|
|
5
|
-
enumerable: true,
|
|
6
|
-
configurable: true,
|
|
7
|
-
writable: true
|
|
8
|
-
});
|
|
9
|
-
} else {
|
|
10
|
-
obj[key] = value;
|
|
11
|
-
}
|
|
12
|
-
return obj;
|
|
13
|
-
}
|
|
14
1
|
import * as tsUtils from 'tsutils';
|
|
15
2
|
import * as ts from 'typescript';
|
|
16
3
|
import * as Lint from 'tslint';
|
|
17
|
-
|
|
18
|
-
|
|
4
|
+
export class Rule extends Lint.Rules.AbstractRule {
|
|
5
|
+
static metadata = {
|
|
6
|
+
ruleName: 'pair-react-dom-render-unmount',
|
|
7
|
+
description: 'Pair ReactDOM render and unmount calls in one file.' + ' If a ReactDOM render tree is not unmounted when disposed, it will cause a memory leak.',
|
|
8
|
+
rationale: 'Pair the render and unmount calls to avoid memory leak.',
|
|
9
|
+
optionsDescription: 'No options available.',
|
|
10
|
+
options: {},
|
|
11
|
+
type: 'maintainability',
|
|
12
|
+
typescriptOnly: false
|
|
13
|
+
};
|
|
14
|
+
_reactDOMImportNamespaceName;
|
|
19
15
|
apply(sourceFile) {
|
|
20
16
|
return this.applyWithFunction(sourceFile, this._walk.bind(this));
|
|
21
17
|
}
|
|
@@ -67,19 +63,6 @@ export class Rule extends (_Lint_Rules_AbstractRule = Lint.Rules.AbstractRule) {
|
|
|
67
63
|
tsUtils.isIdentifier(node.expression.expression) && node.expression.expression.text === this._reactDOMImportNamespaceName && // method
|
|
68
64
|
tsUtils.isIdentifier(node.expression.name) && node.expression.name.text === methodName);
|
|
69
65
|
}
|
|
70
|
-
constructor(...args){
|
|
71
|
-
super(...args);
|
|
72
|
-
_define_property(this, "_reactDOMImportNamespaceName", void 0);
|
|
73
|
-
}
|
|
74
66
|
}
|
|
75
|
-
_define_property(Rule, "metadata", {
|
|
76
|
-
ruleName: 'pair-react-dom-render-unmount',
|
|
77
|
-
description: 'Pair ReactDOM render and unmount calls in one file.' + ' If a ReactDOM render tree is not unmounted when disposed, it will cause a memory leak.',
|
|
78
|
-
rationale: 'Pair the render and unmount calls to avoid memory leak.',
|
|
79
|
-
optionsDescription: 'No options available.',
|
|
80
|
-
options: {},
|
|
81
|
-
type: 'maintainability',
|
|
82
|
-
typescriptOnly: false
|
|
83
|
-
});
|
|
84
67
|
|
|
85
68
|
//# sourceMappingURL=./pairReactDomRenderUnmountRule.js.map
|
|
@@ -1,38 +1,24 @@
|
|
|
1
|
-
function _define_property(obj, key, value) {
|
|
2
|
-
if (key in obj) {
|
|
3
|
-
Object.defineProperty(obj, key, {
|
|
4
|
-
value: value,
|
|
5
|
-
enumerable: true,
|
|
6
|
-
configurable: true,
|
|
7
|
-
writable: true
|
|
8
|
-
});
|
|
9
|
-
} else {
|
|
10
|
-
obj[key] = value;
|
|
11
|
-
}
|
|
12
|
-
return obj;
|
|
13
|
-
}
|
|
14
1
|
import * as Lint from 'tslint';
|
|
15
2
|
import { isCallExpression, isIdentifier, isPropertyAccessExpression } from 'tsutils';
|
|
16
3
|
import * as ts from 'typescript';
|
|
17
|
-
var _Lint_Rules_AbstractRule;
|
|
18
4
|
/**
|
|
19
5
|
* Validate valid GUID strings are being passed as an argument to SPKillSwitch.isActivated calls.
|
|
20
6
|
* JavaScript does not have a native GUID type. We removed expensive runtime parsing during production
|
|
21
7
|
* builds when checking kill switches. In order to ensure type safety, we are validating at build time with tslint.
|
|
22
|
-
*/ export class Rule extends
|
|
8
|
+
*/ export class Rule extends Lint.Rules.AbstractRule {
|
|
9
|
+
static metadata = {
|
|
10
|
+
ruleName: 'valid-kill-switch-guid',
|
|
11
|
+
description: 'Warn if _SPKillSwitch.isActivated is being called with an incorrect argument',
|
|
12
|
+
rationale: 'Compile time type safety',
|
|
13
|
+
optionsDescription: 'No options available.',
|
|
14
|
+
options: undefined,
|
|
15
|
+
type: 'functionality',
|
|
16
|
+
typescriptOnly: false
|
|
17
|
+
};
|
|
23
18
|
apply(source) {
|
|
24
19
|
return this.applyWithFunction(source, validKillSwitchGuid);
|
|
25
20
|
}
|
|
26
21
|
}
|
|
27
|
-
_define_property(Rule, "metadata", {
|
|
28
|
-
ruleName: 'valid-kill-switch-guid',
|
|
29
|
-
description: 'Warn if _SPKillSwitch.isActivated is being called with an incorrect argument',
|
|
30
|
-
rationale: 'Compile time type safety',
|
|
31
|
-
optionsDescription: 'No options available.',
|
|
32
|
-
options: undefined,
|
|
33
|
-
type: 'functionality',
|
|
34
|
-
typescriptOnly: false
|
|
35
|
-
});
|
|
36
22
|
function validKillSwitchGuid(context, node) {
|
|
37
23
|
if (!node) {
|
|
38
24
|
ts.forEachChild(context.sourceFile, (n)=>validKillSwitchGuid(context, n));
|
package/package.json
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@microsoft/sp-tslint-rules",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.23.0-beta.0",
|
|
4
4
|
"description": "SharePoint Framework tslint rules",
|
|
5
|
-
"license": "https://aka.ms/spfx/license",
|
|
6
5
|
"homepage": "http://aka.ms/spfx",
|
|
6
|
+
"license": "https://aka.ms/spfx/license",
|
|
7
|
+
"engines": {
|
|
8
|
+
"node": ">=18.17.1 <19.0.0 || >=22.14.0 < 23.0.0"
|
|
9
|
+
},
|
|
7
10
|
"main": "lib-commonjs/index.js",
|
|
8
11
|
"module": "lib-esm/index.js",
|
|
9
12
|
"typings": "lib-dts/index.d.ts",
|
|
@@ -27,17 +30,14 @@
|
|
|
27
30
|
]
|
|
28
31
|
}
|
|
29
32
|
},
|
|
30
|
-
"engines": {
|
|
31
|
-
"node": ">=18.17.1 <19.0.0 || >=22.14.0 < 23.0.0"
|
|
32
|
-
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"tslint": "~6.1.3",
|
|
35
35
|
"tsutils": "~2.11.2",
|
|
36
36
|
"typescript": "5.3.3"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@rushstack/heft": "1.
|
|
40
|
-
"eslint": "
|
|
39
|
+
"@rushstack/heft": "1.2.7",
|
|
40
|
+
"eslint": "9.37.0",
|
|
41
41
|
"@msinternal/internal-node-rig": "0.1.0"
|
|
42
42
|
},
|
|
43
43
|
"scripts": {
|