@pnp/cli-microsoft365 5.6.0-beta.18a47a8 → 5.6.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/dist/m365/spfx/commands/project/base-project-command.js +4 -0
- package/dist/m365/spfx/commands/project/project-doctor/doctor-1.15.2.js +23 -0
- package/dist/m365/spfx/commands/project/project-doctor.js +2 -1
- package/dist/m365/spfx/commands/project/project-model/EsLintRcJs.js +3 -0
- package/dist/m365/spfx/commands/project/project-model/index.js +1 -0
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN001034_DEP_microsoft_sp_adaptive_card_extension_base.js +17 -0
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN002026_DEVDEP_typescript.js +14 -0
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN012020_TSC_noImplicitAny.js +46 -0
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN025001_ESLINTRCJS_overrides.js +64 -0
- package/dist/m365/spfx/commands/project/project-upgrade/upgrade-1.15.2.js +433 -0
- package/dist/m365/spfx/commands/project/project-upgrade.js +2 -1
- package/dist/m365/spo/commands/file/file-rename.js +108 -0
- package/dist/m365/spo/commands/group/group-get.js +26 -6
- package/dist/m365/spo/commands/site/site-apppermission-add.js +3 -6
- package/dist/m365/spo/commands/site/site-apppermission-set.js +3 -6
- package/dist/m365/spo/commands.js +1 -0
- package/docs/docs/cmd/spfx/project/project-upgrade.md +1 -1
- package/docs/docs/cmd/spo/file/file-rename.md +43 -0
- package/docs/docs/cmd/spo/group/group-get.md +12 -3
- package/docs/docs/cmd/spo/site/site-apppermission-add.md +1 -1
- package/docs/docs/cmd/spo/site/site-apppermission-set.md +1 -1
- package/package.json +2 -2
|
@@ -138,6 +138,10 @@ class BaseProjectCommand extends AnonymousCommand_1.default {
|
|
|
138
138
|
source: fs.readFileSync(gulpfileJsPath, 'utf-8')
|
|
139
139
|
};
|
|
140
140
|
}
|
|
141
|
+
const esLintRcJsPath = path.join(projectRootPath, '.eslintrc.js');
|
|
142
|
+
if (fs.existsSync(esLintRcJsPath)) {
|
|
143
|
+
project.esLintRcJs = new project_model_1.TsFile(esLintRcJsPath);
|
|
144
|
+
}
|
|
141
145
|
project.vsCode = {};
|
|
142
146
|
const vsCodeSettingsPath = path.join(projectRootPath, '.vscode', 'settings.json');
|
|
143
147
|
if (fs.existsSync(vsCodeSettingsPath)) {
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const FN001008_DEP_react_1 = require("./rules/FN001008_DEP_react");
|
|
4
|
+
const FN001009_DEP_react_dom_1 = require("./rules/FN001009_DEP_react_dom");
|
|
5
|
+
const FN001022_DEP_office_ui_fabric_react_1 = require("./rules/FN001022_DEP_office_ui_fabric_react");
|
|
6
|
+
const FN002004_DEVDEP_gulp_1 = require("./rules/FN002004_DEVDEP_gulp");
|
|
7
|
+
const FN002007_DEVDEP_ajv_1 = require("./rules/FN002007_DEVDEP_ajv");
|
|
8
|
+
const FN002013_DEVDEP_types_webpack_env_1 = require("./rules/FN002013_DEVDEP_types_webpack_env");
|
|
9
|
+
const FN002015_DEVDEP_types_react_1 = require("./rules/FN002015_DEVDEP_types_react");
|
|
10
|
+
const FN002016_DEVDEP_types_react_dom_1 = require("./rules/FN002016_DEVDEP_types_react_dom");
|
|
11
|
+
const FN002019_DEVDEP_microsoft_rush_stack_compiler_1 = require("./rules/FN002019_DEVDEP_microsoft_rush_stack_compiler");
|
|
12
|
+
module.exports = [
|
|
13
|
+
new FN001008_DEP_react_1.FN001008_DEP_react('16'),
|
|
14
|
+
new FN001009_DEP_react_dom_1.FN001009_DEP_react_dom('16'),
|
|
15
|
+
new FN001022_DEP_office_ui_fabric_react_1.FN001022_DEP_office_ui_fabric_react('7.185.7'),
|
|
16
|
+
new FN002004_DEVDEP_gulp_1.FN002004_DEVDEP_gulp('4.0.2'),
|
|
17
|
+
new FN002007_DEVDEP_ajv_1.FN002007_DEVDEP_ajv('^6.12.5'),
|
|
18
|
+
new FN002013_DEVDEP_types_webpack_env_1.FN002013_DEVDEP_types_webpack_env('~1.15.2'),
|
|
19
|
+
new FN002015_DEVDEP_types_react_1.FN002015_DEVDEP_types_react('16'),
|
|
20
|
+
new FN002016_DEVDEP_types_react_dom_1.FN002016_DEVDEP_types_react_dom('16'),
|
|
21
|
+
new FN002019_DEVDEP_microsoft_rush_stack_compiler_1.FN002019_DEVDEP_microsoft_rush_stack_compiler(['4.5'])
|
|
22
|
+
];
|
|
23
|
+
//# sourceMappingURL=doctor-1.15.2.js.map
|
|
@@ -17,6 +17,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./ConfigJson"), exports);
|
|
18
18
|
__exportStar(require("./CopyAssetsJson"), exports);
|
|
19
19
|
__exportStar(require("./DeployAzureStorageJson"), exports);
|
|
20
|
+
__exportStar(require("./EsLintRcJs"), exports);
|
|
20
21
|
__exportStar(require("./Gitignore"), exports);
|
|
21
22
|
__exportStar(require("./GulpfileJs"), exports);
|
|
22
23
|
__exportStar(require("./JsonFile"), exports);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FN001034_DEP_microsoft_sp_adaptive_card_extension_base = void 0;
|
|
4
|
+
const DependencyRule_1 = require("./DependencyRule");
|
|
5
|
+
class FN001034_DEP_microsoft_sp_adaptive_card_extension_base extends DependencyRule_1.DependencyRule {
|
|
6
|
+
constructor(packageVersion) {
|
|
7
|
+
super('@microsoft/sp-adaptive-card-extension-base', packageVersion, false, false);
|
|
8
|
+
}
|
|
9
|
+
get id() {
|
|
10
|
+
return 'FN001034';
|
|
11
|
+
}
|
|
12
|
+
get severity() {
|
|
13
|
+
return 'Optional';
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.FN001034_DEP_microsoft_sp_adaptive_card_extension_base = FN001034_DEP_microsoft_sp_adaptive_card_extension_base;
|
|
17
|
+
//# sourceMappingURL=FN001034_DEP_microsoft_sp_adaptive_card_extension_base.js.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FN002026_DEVDEP_typescript = void 0;
|
|
4
|
+
const DependencyRule_1 = require("./DependencyRule");
|
|
5
|
+
class FN002026_DEVDEP_typescript extends DependencyRule_1.DependencyRule {
|
|
6
|
+
constructor(packageVersion) {
|
|
7
|
+
super('typescript', packageVersion, true);
|
|
8
|
+
}
|
|
9
|
+
get id() {
|
|
10
|
+
return 'FN002026';
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.FN002026_DEVDEP_typescript = FN002026_DEVDEP_typescript;
|
|
14
|
+
//# sourceMappingURL=FN002026_DEVDEP_typescript.js.map
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FN012020_TSC_noImplicitAny = void 0;
|
|
4
|
+
const JsonRule_1 = require("../../JsonRule");
|
|
5
|
+
class FN012020_TSC_noImplicitAny extends JsonRule_1.JsonRule {
|
|
6
|
+
constructor(noImplicitAny) {
|
|
7
|
+
super();
|
|
8
|
+
this.noImplicitAny = noImplicitAny;
|
|
9
|
+
}
|
|
10
|
+
get id() {
|
|
11
|
+
return 'FN012020';
|
|
12
|
+
}
|
|
13
|
+
get title() {
|
|
14
|
+
return 'tsconfig.json noImplicitAny';
|
|
15
|
+
}
|
|
16
|
+
get description() {
|
|
17
|
+
return `Add noImplicitAny in tsconfig.json`;
|
|
18
|
+
}
|
|
19
|
+
get resolution() {
|
|
20
|
+
return `{
|
|
21
|
+
"compilerOptions": {
|
|
22
|
+
"noImplicitAny": ${this.noImplicitAny}
|
|
23
|
+
}
|
|
24
|
+
}`;
|
|
25
|
+
}
|
|
26
|
+
get resolutionType() {
|
|
27
|
+
return 'json';
|
|
28
|
+
}
|
|
29
|
+
get severity() {
|
|
30
|
+
return 'Required';
|
|
31
|
+
}
|
|
32
|
+
get file() {
|
|
33
|
+
return './tsconfig.json';
|
|
34
|
+
}
|
|
35
|
+
visit(project, findings) {
|
|
36
|
+
if (!project.tsConfigJson || !project.tsConfigJson.compilerOptions) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
if (project.tsConfigJson.compilerOptions.noImplicitAny !== this.noImplicitAny) {
|
|
40
|
+
const node = this.getAstNodeFromFile(project.tsConfigJson, 'compilerOptions.noImplicitAny');
|
|
41
|
+
this.addFindingWithPosition(findings, node);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
exports.FN012020_TSC_noImplicitAny = FN012020_TSC_noImplicitAny;
|
|
46
|
+
//# sourceMappingURL=FN012020_TSC_noImplicitAny.js.map
|
package/dist/m365/spfx/commands/project/project-upgrade/rules/FN025001_ESLINTRCJS_overrides.js
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FN025001_ESLINTRCJS_overrides = void 0;
|
|
4
|
+
const TsRule_1 = require("./TsRule");
|
|
5
|
+
const ts = require("typescript");
|
|
6
|
+
class FN025001_ESLINTRCJS_overrides extends TsRule_1.TsRule {
|
|
7
|
+
constructor(contents) {
|
|
8
|
+
super();
|
|
9
|
+
this.contents = contents;
|
|
10
|
+
}
|
|
11
|
+
get id() {
|
|
12
|
+
return 'FN025001';
|
|
13
|
+
}
|
|
14
|
+
get title() {
|
|
15
|
+
return '.eslintrc.js overrides';
|
|
16
|
+
}
|
|
17
|
+
get description() {
|
|
18
|
+
return `Add overrides in .eslintrc.js`;
|
|
19
|
+
}
|
|
20
|
+
get resolution() {
|
|
21
|
+
return `module.exports = {
|
|
22
|
+
overrides: [
|
|
23
|
+
${this.contents}
|
|
24
|
+
]
|
|
25
|
+
};`;
|
|
26
|
+
}
|
|
27
|
+
get resolutionType() {
|
|
28
|
+
return 'js';
|
|
29
|
+
}
|
|
30
|
+
get severity() {
|
|
31
|
+
return 'Required';
|
|
32
|
+
}
|
|
33
|
+
get file() {
|
|
34
|
+
return './.eslintrc.js';
|
|
35
|
+
}
|
|
36
|
+
visit(project, findings) {
|
|
37
|
+
if (!project.esLintRcJs) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
const nodes = project.esLintRcJs.nodes;
|
|
41
|
+
if (!nodes) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
const occurrences = [];
|
|
45
|
+
if (nodes
|
|
46
|
+
.filter(node => ts.isIdentifier(node))
|
|
47
|
+
.map(node => node)
|
|
48
|
+
.filter(i => i.getText() === 'overrides').length !== 0) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
const node = nodes
|
|
52
|
+
.map(node => node)
|
|
53
|
+
.find(i => i.text === 'module');
|
|
54
|
+
if (!node) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
this.addOccurrence(this.resolution, project.esLintRcJs.path, project.path, node, occurrences);
|
|
58
|
+
if (occurrences.length > 0) {
|
|
59
|
+
this.addFindingWithOccurrences(occurrences, findings);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
exports.FN025001_ESLINTRCJS_overrides = FN025001_ESLINTRCJS_overrides;
|
|
64
|
+
//# sourceMappingURL=FN025001_ESLINTRCJS_overrides.js.map
|
|
@@ -0,0 +1,433 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const FN001001_DEP_microsoft_sp_core_library_1 = require("./rules/FN001001_DEP_microsoft_sp_core_library");
|
|
4
|
+
const FN001002_DEP_microsoft_sp_lodash_subset_1 = require("./rules/FN001002_DEP_microsoft_sp_lodash_subset");
|
|
5
|
+
const FN001003_DEP_microsoft_sp_office_ui_fabric_core_1 = require("./rules/FN001003_DEP_microsoft_sp_office_ui_fabric_core");
|
|
6
|
+
const FN001004_DEP_microsoft_sp_webpart_base_1 = require("./rules/FN001004_DEP_microsoft_sp_webpart_base");
|
|
7
|
+
const FN001011_DEP_microsoft_sp_dialog_1 = require("./rules/FN001011_DEP_microsoft_sp_dialog");
|
|
8
|
+
const FN001012_DEP_microsoft_sp_application_base_1 = require("./rules/FN001012_DEP_microsoft_sp_application_base");
|
|
9
|
+
const FN001013_DEP_microsoft_decorators_1 = require("./rules/FN001013_DEP_microsoft_decorators");
|
|
10
|
+
const FN001014_DEP_microsoft_sp_listview_extensibility_1 = require("./rules/FN001014_DEP_microsoft_sp_listview_extensibility");
|
|
11
|
+
const FN001021_DEP_microsoft_sp_property_pane_1 = require("./rules/FN001021_DEP_microsoft_sp_property_pane");
|
|
12
|
+
const FN001023_DEP_microsoft_sp_component_base_1 = require("./rules/FN001023_DEP_microsoft_sp_component_base");
|
|
13
|
+
const FN001024_DEP_microsoft_sp_diagnostics_1 = require("./rules/FN001024_DEP_microsoft_sp_diagnostics");
|
|
14
|
+
const FN001025_DEP_microsoft_sp_dynamic_data_1 = require("./rules/FN001025_DEP_microsoft_sp_dynamic_data");
|
|
15
|
+
const FN001026_DEP_microsoft_sp_extension_base_1 = require("./rules/FN001026_DEP_microsoft_sp_extension_base");
|
|
16
|
+
const FN001027_DEP_microsoft_sp_http_1 = require("./rules/FN001027_DEP_microsoft_sp_http");
|
|
17
|
+
const FN001028_DEP_microsoft_sp_list_subscription_1 = require("./rules/FN001028_DEP_microsoft_sp_list_subscription");
|
|
18
|
+
const FN001029_DEP_microsoft_sp_loader_1 = require("./rules/FN001029_DEP_microsoft_sp_loader");
|
|
19
|
+
const FN001030_DEP_microsoft_sp_module_interfaces_1 = require("./rules/FN001030_DEP_microsoft_sp_module_interfaces");
|
|
20
|
+
const FN001031_DEP_microsoft_sp_odata_types_1 = require("./rules/FN001031_DEP_microsoft_sp_odata_types");
|
|
21
|
+
const FN001032_DEP_microsoft_sp_page_context_1 = require("./rules/FN001032_DEP_microsoft_sp_page_context");
|
|
22
|
+
const FN001034_DEP_microsoft_sp_adaptive_card_extension_base_1 = require("./rules/FN001034_DEP_microsoft_sp_adaptive_card_extension_base");
|
|
23
|
+
const FN002001_DEVDEP_microsoft_sp_build_web_1 = require("./rules/FN002001_DEVDEP_microsoft_sp_build_web");
|
|
24
|
+
const FN002002_DEVDEP_microsoft_sp_module_interfaces_1 = require("./rules/FN002002_DEVDEP_microsoft_sp_module_interfaces");
|
|
25
|
+
const FN002022_DEVDEP_microsoft_eslint_plugin_spfx_1 = require("./rules/FN002022_DEVDEP_microsoft_eslint_plugin_spfx");
|
|
26
|
+
const FN002023_DEVDEP_microsoft_eslint_config_spfx_1 = require("./rules/FN002023_DEVDEP_microsoft_eslint_config_spfx");
|
|
27
|
+
const FN002026_DEVDEP_typescript_1 = require("./rules/FN002026_DEVDEP_typescript");
|
|
28
|
+
const FN007001_CFG_S_schema_1 = require("./rules/FN007001_CFG_S_schema");
|
|
29
|
+
const FN010001_YORC_version_1 = require("./rules/FN010001_YORC_version");
|
|
30
|
+
const FN012020_TSC_noImplicitAny_1 = require("./rules/FN012020_TSC_noImplicitAny");
|
|
31
|
+
const FN025001_ESLINTRCJS_overrides_1 = require("./rules/FN025001_ESLINTRCJS_overrides");
|
|
32
|
+
module.exports = [
|
|
33
|
+
new FN001001_DEP_microsoft_sp_core_library_1.FN001001_DEP_microsoft_sp_core_library('1.15.2'),
|
|
34
|
+
new FN001021_DEP_microsoft_sp_property_pane_1.FN001021_DEP_microsoft_sp_property_pane('1.15.2'),
|
|
35
|
+
new FN001004_DEP_microsoft_sp_webpart_base_1.FN001004_DEP_microsoft_sp_webpart_base('1.15.2'),
|
|
36
|
+
new FN001002_DEP_microsoft_sp_lodash_subset_1.FN001002_DEP_microsoft_sp_lodash_subset('1.15.2'),
|
|
37
|
+
new FN001003_DEP_microsoft_sp_office_ui_fabric_core_1.FN001003_DEP_microsoft_sp_office_ui_fabric_core('1.15.2'),
|
|
38
|
+
new FN001034_DEP_microsoft_sp_adaptive_card_extension_base_1.FN001034_DEP_microsoft_sp_adaptive_card_extension_base('1.15.2'),
|
|
39
|
+
new FN001023_DEP_microsoft_sp_component_base_1.FN001023_DEP_microsoft_sp_component_base('1.15.2'),
|
|
40
|
+
new FN001024_DEP_microsoft_sp_diagnostics_1.FN001024_DEP_microsoft_sp_diagnostics('1.15.2'),
|
|
41
|
+
new FN001025_DEP_microsoft_sp_dynamic_data_1.FN001025_DEP_microsoft_sp_dynamic_data('1.15.2'),
|
|
42
|
+
new FN001026_DEP_microsoft_sp_extension_base_1.FN001026_DEP_microsoft_sp_extension_base('1.15.2'),
|
|
43
|
+
new FN001027_DEP_microsoft_sp_http_1.FN001027_DEP_microsoft_sp_http('1.15.2'),
|
|
44
|
+
new FN001028_DEP_microsoft_sp_list_subscription_1.FN001028_DEP_microsoft_sp_list_subscription('1.15.2'),
|
|
45
|
+
new FN001029_DEP_microsoft_sp_loader_1.FN001029_DEP_microsoft_sp_loader('1.15.2'),
|
|
46
|
+
new FN001030_DEP_microsoft_sp_module_interfaces_1.FN001030_DEP_microsoft_sp_module_interfaces('1.15.2'),
|
|
47
|
+
new FN001031_DEP_microsoft_sp_odata_types_1.FN001031_DEP_microsoft_sp_odata_types('1.15.2'),
|
|
48
|
+
new FN001032_DEP_microsoft_sp_page_context_1.FN001032_DEP_microsoft_sp_page_context('1.15.2'),
|
|
49
|
+
new FN001013_DEP_microsoft_decorators_1.FN001013_DEP_microsoft_decorators('1.15.2'),
|
|
50
|
+
new FN001011_DEP_microsoft_sp_dialog_1.FN001011_DEP_microsoft_sp_dialog('1.15.2'),
|
|
51
|
+
new FN001012_DEP_microsoft_sp_application_base_1.FN001012_DEP_microsoft_sp_application_base('1.15.2'),
|
|
52
|
+
new FN001014_DEP_microsoft_sp_listview_extensibility_1.FN001014_DEP_microsoft_sp_listview_extensibility('1.15.2'),
|
|
53
|
+
new FN002022_DEVDEP_microsoft_eslint_plugin_spfx_1.FN002022_DEVDEP_microsoft_eslint_plugin_spfx('1.15.2'),
|
|
54
|
+
new FN002023_DEVDEP_microsoft_eslint_config_spfx_1.FN002023_DEVDEP_microsoft_eslint_config_spfx('1.15.2'),
|
|
55
|
+
new FN002001_DEVDEP_microsoft_sp_build_web_1.FN002001_DEVDEP_microsoft_sp_build_web('1.15.2'),
|
|
56
|
+
new FN002002_DEVDEP_microsoft_sp_module_interfaces_1.FN002002_DEVDEP_microsoft_sp_module_interfaces('1.15.2'),
|
|
57
|
+
new FN002026_DEVDEP_typescript_1.FN002026_DEVDEP_typescript('4.5.5'),
|
|
58
|
+
new FN010001_YORC_version_1.FN010001_YORC_version('1.15.2'),
|
|
59
|
+
new FN012020_TSC_noImplicitAny_1.FN012020_TSC_noImplicitAny(true),
|
|
60
|
+
new FN007001_CFG_S_schema_1.FN007001_CFG_S_schema('https://developer.microsoft.com/json-schemas/spfx-build/spfx-serve.schema.json'),
|
|
61
|
+
new FN025001_ESLINTRCJS_overrides_1.FN025001_ESLINTRCJS_overrides(`{
|
|
62
|
+
files: ['*.ts', '*.tsx'],
|
|
63
|
+
parser: '@typescript-eslint/parser',
|
|
64
|
+
'parserOptions': {
|
|
65
|
+
'project': './tsconfig.json',
|
|
66
|
+
'ecmaVersion': 2018,
|
|
67
|
+
'sourceType': 'module'
|
|
68
|
+
},
|
|
69
|
+
rules: {
|
|
70
|
+
// Prevent usage of the JavaScript null value, while allowing code to access existing APIs that may require null. https://www.npmjs.com/package/@rushstack/eslint-plugin
|
|
71
|
+
'@rushstack/no-new-null': 1,
|
|
72
|
+
// Require Jest module mocking APIs to be called before any other statements in their code block. https://www.npmjs.com/package/@rushstack/eslint-plugin
|
|
73
|
+
'@rushstack/hoist-jest-mock': 1,
|
|
74
|
+
// Require regular expressions to be constructed from string constants rather than dynamically building strings at runtime. https://www.npmjs.com/package/@rushstack/eslint-plugin-security
|
|
75
|
+
'@rushstack/security/no-unsafe-regexp': 1,
|
|
76
|
+
// STANDARDIZED BY: @typescript-eslint\\eslint-plugin\\dist\\configs\\recommended.json
|
|
77
|
+
'@typescript-eslint/adjacent-overload-signatures': 1,
|
|
78
|
+
// STANDARDIZED BY: @typescript-eslint\\eslint-plugin\\dist\\configs\\recommended.json
|
|
79
|
+
//
|
|
80
|
+
// CONFIGURATION: By default, these are banned: String, Boolean, Number, Object, Symbol
|
|
81
|
+
'@typescript-eslint/ban-types': [
|
|
82
|
+
1,
|
|
83
|
+
{
|
|
84
|
+
'extendDefaults': false,
|
|
85
|
+
'types': {
|
|
86
|
+
'String': {
|
|
87
|
+
'message': 'Use \\'string\\' instead',
|
|
88
|
+
'fixWith': 'string'
|
|
89
|
+
},
|
|
90
|
+
'Boolean': {
|
|
91
|
+
'message': 'Use \\'boolean\\' instead',
|
|
92
|
+
'fixWith': 'boolean'
|
|
93
|
+
},
|
|
94
|
+
'Number': {
|
|
95
|
+
'message': 'Use \\'number\\' instead',
|
|
96
|
+
'fixWith': 'number'
|
|
97
|
+
},
|
|
98
|
+
'Object': {
|
|
99
|
+
'message': 'Use \\'object\\' instead, or else define a proper TypeScript type:'
|
|
100
|
+
},
|
|
101
|
+
'Symbol': {
|
|
102
|
+
'message': 'Use \\'symbol\\' instead',
|
|
103
|
+
'fixWith': 'symbol'
|
|
104
|
+
},
|
|
105
|
+
'Function': {
|
|
106
|
+
'message': 'The \\'Function\\' type accepts any function-like value.\nIt provides no type safety when calling the function, which can be a common source of bugs.\nIt also accepts things like class declarations, which will throw at runtime as they will not be called with \'new\'.\nIf you are expecting the function to accept certain arguments, you should explicitly define the function shape.'
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
],
|
|
111
|
+
// RATIONALE: Code is more readable when the type of every variable is immediately obvious.
|
|
112
|
+
// Even if the compiler may be able to infer a type, this inference will be unavailable
|
|
113
|
+
// to a person who is reviewing a GitHub diff. This rule makes writing code harder,
|
|
114
|
+
// but writing code is a much less important activity than reading it.
|
|
115
|
+
//
|
|
116
|
+
// STANDARDIZED BY: @typescript-eslint\\eslint-plugin\\dist\\configs\\recommended.json
|
|
117
|
+
'@typescript-eslint/explicit-function-return-type': [
|
|
118
|
+
1,
|
|
119
|
+
{
|
|
120
|
+
'allowExpressions': true,
|
|
121
|
+
'allowTypedFunctionExpressions': true,
|
|
122
|
+
'allowHigherOrderFunctions': false
|
|
123
|
+
}
|
|
124
|
+
],
|
|
125
|
+
// STANDARDIZED BY: @typescript-eslint\\eslint-plugin\\dist\\configs\\recommended.json
|
|
126
|
+
// Rationale to disable: although this is a recommended rule, it is up to dev to select coding style.
|
|
127
|
+
// Set to 1 (warning) or 2 (error) to enable.
|
|
128
|
+
'@typescript-eslint/explicit-member-accessibility': 0,
|
|
129
|
+
// STANDARDIZED BY: @typescript-eslint\\eslint-plugin\\dist\\configs\\recommended.json
|
|
130
|
+
'@typescript-eslint/no-array-constructor': 1,
|
|
131
|
+
// STANDARDIZED BY: @typescript-eslint\\eslint-plugin\\dist\\configs\\recommended.json
|
|
132
|
+
//
|
|
133
|
+
// RATIONALE: The "any" keyword disables static type checking, the main benefit of using TypeScript.
|
|
134
|
+
// This rule should be suppressed only in very special cases such as JSON.stringify()
|
|
135
|
+
// where the type really can be anything. Even if the type is flexible, another type
|
|
136
|
+
// may be more appropriate such as "unknown", "{}", or "Record<k,V>".
|
|
137
|
+
'@typescript-eslint/no-explicit-any': 1,
|
|
138
|
+
// RATIONALE: The #1 rule of promises is that every promise chain must be terminated by a catch()
|
|
139
|
+
// handler. Thus wherever a Promise arises, the code must either append a catch handler,
|
|
140
|
+
// or else return the object to a caller (who assumes this responsibility). Unterminated
|
|
141
|
+
// promise chains are a serious issue. Besides causing errors to be silently ignored,
|
|
142
|
+
// they can also cause a NodeJS process to terminate unexpectedly.
|
|
143
|
+
'@typescript-eslint/no-floating-promises': 2,
|
|
144
|
+
// RATIONALE: Catches a common coding mistake.
|
|
145
|
+
'@typescript-eslint/no-for-in-array': 2,
|
|
146
|
+
// STANDARDIZED BY: @typescript-eslint\\eslint-plugin\\dist\\configs\\recommended.json
|
|
147
|
+
'@typescript-eslint/no-misused-new': 2,
|
|
148
|
+
// RATIONALE: The "namespace" keyword is not recommended for organizing code because JavaScript lacks
|
|
149
|
+
// a "using" statement to traverse namespaces. Nested namespaces prevent certain bundler
|
|
150
|
+
// optimizations. If you are declaring loose functions/variables, it's better to make them
|
|
151
|
+
// static members of a class, since classes support property getters and their private
|
|
152
|
+
// members are accessible by unit tests. Also, the exercise of choosing a meaningful
|
|
153
|
+
// class name tends to produce more discoverable APIs: for example, search+replacing
|
|
154
|
+
// the function "reverse()" is likely to return many false matches, whereas if we always
|
|
155
|
+
// write "Text.reverse()" is more unique. For large scale organization, it's recommended
|
|
156
|
+
// to decompose your code into separate NPM packages, which ensures that component
|
|
157
|
+
// dependencies are tracked more conscientiously.
|
|
158
|
+
//
|
|
159
|
+
// STANDARDIZED BY: @typescript-eslint\\eslint-plugin\\dist\\configs\\recommended.json
|
|
160
|
+
'@typescript-eslint/no-namespace': [
|
|
161
|
+
1,
|
|
162
|
+
{
|
|
163
|
+
'allowDeclarations': false,
|
|
164
|
+
'allowDefinitionFiles': false
|
|
165
|
+
}
|
|
166
|
+
],
|
|
167
|
+
// RATIONALE: Parameter properties provide a shorthand such as "constructor(public title: string)"
|
|
168
|
+
// that avoids the effort of declaring "title" as a field. This TypeScript feature makes
|
|
169
|
+
// code easier to write, but arguably sacrifices readability: In the notes for
|
|
170
|
+
// "@typescript-eslint/member-ordering" we pointed out that fields are central to
|
|
171
|
+
// a class's design, so we wouldn't want to bury them in a constructor signature
|
|
172
|
+
// just to save some typing.
|
|
173
|
+
//
|
|
174
|
+
// STANDARDIZED BY: @typescript-eslint\\eslint-plugin\\dist\\configs\\recommended.json
|
|
175
|
+
// Set to 1 (warning) or 2 (error) to enable the rule
|
|
176
|
+
'@typescript-eslint/no-parameter-properties': 0,
|
|
177
|
+
// RATIONALE: When left in shipping code, unused variables often indicate a mistake. Dead code
|
|
178
|
+
// may impact performance.
|
|
179
|
+
//
|
|
180
|
+
// STANDARDIZED BY: @typescript-eslint\\eslint-plugin\\dist\\configs\\recommended.json
|
|
181
|
+
'@typescript-eslint/no-unused-vars': [
|
|
182
|
+
1,
|
|
183
|
+
{
|
|
184
|
+
'vars': 'all',
|
|
185
|
+
// Unused function arguments often indicate a mistake in JavaScript code. However in TypeScript code,
|
|
186
|
+
// the compiler catches most of those mistakes, and unused arguments are fairly common for type signatures
|
|
187
|
+
// that are overriding a base class method or implementing an interface.
|
|
188
|
+
'args': 'none'
|
|
189
|
+
}
|
|
190
|
+
],
|
|
191
|
+
// STANDARDIZED BY: @typescript-eslint\\eslint-plugin\\dist\\configs\\recommended.json
|
|
192
|
+
'@typescript-eslint/no-use-before-define': [
|
|
193
|
+
2,
|
|
194
|
+
{
|
|
195
|
+
'functions': false,
|
|
196
|
+
'classes': true,
|
|
197
|
+
'variables': true,
|
|
198
|
+
'enums': true,
|
|
199
|
+
'typedefs': true
|
|
200
|
+
}
|
|
201
|
+
],
|
|
202
|
+
// Disallows require statements except in import statements.
|
|
203
|
+
// In other words, the use of forms such as var foo = require("foo") are banned. Instead use ES6 style imports or import foo = require("foo") imports.
|
|
204
|
+
'@typescript-eslint/no-var-requires': 'error',
|
|
205
|
+
// RATIONALE: The "module" keyword is deprecated except when describing legacy libraries.
|
|
206
|
+
//
|
|
207
|
+
// STANDARDIZED BY: @typescript-eslint\\eslint-plugin\\dist\\configs\\recommended.json
|
|
208
|
+
'@typescript-eslint/prefer-namespace-keyword': 1,
|
|
209
|
+
// STANDARDIZED BY: @typescript-eslint\\eslint-plugin\\dist\\configs\\recommended.json
|
|
210
|
+
// Rationale to disable: it's up to developer to decide if he wants to add type annotations
|
|
211
|
+
// Set to 1 (warning) or 2 (error) to enable the rule
|
|
212
|
+
'@typescript-eslint/no-inferrable-types': 0,
|
|
213
|
+
// STANDARDIZED BY: @typescript-eslint\\eslint-plugin\\dist\\configs\\recommended.json
|
|
214
|
+
// Rationale to disable: declaration of empty interfaces may be helpful for generic types scenarios
|
|
215
|
+
'@typescript-eslint/no-empty-interface': 0,
|
|
216
|
+
// RATIONALE: This rule warns if setters are defined without getters, which is probably a mistake.
|
|
217
|
+
'accessor-pairs': 1,
|
|
218
|
+
// RATIONALE: In TypeScript, if you write x["y"] instead of x.y, it disables type checking.
|
|
219
|
+
'dot-notation': [
|
|
220
|
+
1,
|
|
221
|
+
{
|
|
222
|
+
'allowPattern': '^_'
|
|
223
|
+
}
|
|
224
|
+
],
|
|
225
|
+
// RATIONALE: Catches code that is likely to be incorrect
|
|
226
|
+
'eqeqeq': 1,
|
|
227
|
+
// STANDARDIZED BY: eslint\\conf\\eslint-recommended.js
|
|
228
|
+
'for-direction': 1,
|
|
229
|
+
// RATIONALE: Catches a common coding mistake.
|
|
230
|
+
'guard-for-in': 2,
|
|
231
|
+
// RATIONALE: If you have more than 2,000 lines in a single source file, it's probably time
|
|
232
|
+
// to split up your code.
|
|
233
|
+
'max-lines': ['warn', { max: 2000 }],
|
|
234
|
+
// STANDARDIZED BY: eslint\\conf\\eslint-recommended.js
|
|
235
|
+
'no-async-promise-executor': 2,
|
|
236
|
+
// RATIONALE: Deprecated language feature.
|
|
237
|
+
'no-caller': 2,
|
|
238
|
+
// STANDARDIZED BY: eslint\\conf\\eslint-recommended.js
|
|
239
|
+
'no-compare-neg-zero': 2,
|
|
240
|
+
// STANDARDIZED BY: eslint\\conf\\eslint-recommended.js
|
|
241
|
+
'no-cond-assign': 2,
|
|
242
|
+
// STANDARDIZED BY: eslint\\conf\\eslint-recommended.js
|
|
243
|
+
'no-constant-condition': 1,
|
|
244
|
+
// STANDARDIZED BY: eslint\\conf\\eslint-recommended.js
|
|
245
|
+
'no-control-regex': 2,
|
|
246
|
+
// STANDARDIZED BY: eslint\\conf\\eslint-recommended.js
|
|
247
|
+
'no-debugger': 1,
|
|
248
|
+
// STANDARDIZED BY: eslint\\conf\\eslint-recommended.js
|
|
249
|
+
'no-delete-var': 2,
|
|
250
|
+
// RATIONALE: Catches code that is likely to be incorrect
|
|
251
|
+
// STANDARDIZED BY: eslint\\conf\\eslint-recommended.js
|
|
252
|
+
'no-duplicate-case': 2,
|
|
253
|
+
// STANDARDIZED BY: eslint\\conf\\eslint-recommended.js
|
|
254
|
+
'no-empty': 1,
|
|
255
|
+
// STANDARDIZED BY: eslint\\conf\\eslint-recommended.js
|
|
256
|
+
'no-empty-character-class': 2,
|
|
257
|
+
// STANDARDIZED BY: eslint\\conf\\eslint-recommended.js
|
|
258
|
+
'no-empty-pattern': 1,
|
|
259
|
+
// RATIONALE: Eval is a security concern and a performance concern.
|
|
260
|
+
'no-eval': 1,
|
|
261
|
+
// RATIONALE: Catches code that is likely to be incorrect
|
|
262
|
+
// STANDARDIZED BY: eslint\\conf\\eslint-recommended.js
|
|
263
|
+
'no-ex-assign': 2,
|
|
264
|
+
// RATIONALE: System types are global and should not be tampered with in a scalable code base.
|
|
265
|
+
// If two different libraries (or two versions of the same library) both try to modify
|
|
266
|
+
// a type, only one of them can win. Polyfills are acceptable because they implement
|
|
267
|
+
// a standardized interoperable contract, but polyfills are generally coded in plain
|
|
268
|
+
// JavaScript.
|
|
269
|
+
'no-extend-native': 1,
|
|
270
|
+
// Disallow unnecessary labels
|
|
271
|
+
'no-extra-label': 1,
|
|
272
|
+
// STANDARDIZED BY: eslint\\conf\\eslint-recommended.js
|
|
273
|
+
'no-fallthrough': 2,
|
|
274
|
+
// STANDARDIZED BY: eslint\\conf\\eslint-recommended.js
|
|
275
|
+
'no-func-assign': 1,
|
|
276
|
+
// RATIONALE: Catches a common coding mistake.
|
|
277
|
+
'no-implied-eval': 2,
|
|
278
|
+
// STANDARDIZED BY: eslint\\conf\\eslint-recommended.js
|
|
279
|
+
'no-invalid-regexp': 2,
|
|
280
|
+
// RATIONALE: Catches a common coding mistake.
|
|
281
|
+
'no-label-var': 2,
|
|
282
|
+
// RATIONALE: Eliminates redundant code.
|
|
283
|
+
'no-lone-blocks': 1,
|
|
284
|
+
// STANDARDIZED BY: eslint\\conf\\eslint-recommended.js
|
|
285
|
+
'no-misleading-character-class': 2,
|
|
286
|
+
// RATIONALE: Catches a common coding mistake.
|
|
287
|
+
'no-multi-str': 2,
|
|
288
|
+
// RATIONALE: It's generally a bad practice to call "new Thing()" without assigning the result to
|
|
289
|
+
// a variable. Either it's part of an awkward expression like "(new Thing()).doSomething()",
|
|
290
|
+
// or else implies that the constructor is doing nontrivial computations, which is often
|
|
291
|
+
// a poor class design.
|
|
292
|
+
'no-new': 1,
|
|
293
|
+
// RATIONALE: Obsolete language feature that is deprecated.
|
|
294
|
+
'no-new-func': 2,
|
|
295
|
+
// RATIONALE: Obsolete language feature that is deprecated.
|
|
296
|
+
'no-new-object': 2,
|
|
297
|
+
// RATIONALE: Obsolete notation.
|
|
298
|
+
'no-new-wrappers': 1,
|
|
299
|
+
// RATIONALE: Catches code that is likely to be incorrect
|
|
300
|
+
// STANDARDIZED BY: eslint\\conf\\eslint-recommended.js
|
|
301
|
+
'no-octal': 2,
|
|
302
|
+
// RATIONALE: Catches code that is likely to be incorrect
|
|
303
|
+
'no-octal-escape': 2,
|
|
304
|
+
// RATIONALE: Catches code that is likely to be incorrect
|
|
305
|
+
// STANDARDIZED BY: eslint\\conf\\eslint-recommended.js
|
|
306
|
+
'no-regex-spaces': 2,
|
|
307
|
+
// RATIONALE: Catches a common coding mistake.
|
|
308
|
+
'no-return-assign': 2,
|
|
309
|
+
// RATIONALE: Security risk.
|
|
310
|
+
'no-script-url': 1,
|
|
311
|
+
// STANDARDIZED BY: eslint\\conf\\eslint-recommended.js
|
|
312
|
+
'no-self-assign': 2,
|
|
313
|
+
// RATIONALE: Catches a common coding mistake.
|
|
314
|
+
'no-self-compare': 2,
|
|
315
|
+
// RATIONALE: This avoids statements such as "while (a = next(), a && a.length);" that use
|
|
316
|
+
// commas to create compound expressions. In general code is more readable if each
|
|
317
|
+
// step is split onto a separate line. This also makes it easier to set breakpoints
|
|
318
|
+
// in the debugger.
|
|
319
|
+
'no-sequences': 1,
|
|
320
|
+
// RATIONALE: Catches code that is likely to be incorrect
|
|
321
|
+
// STANDARDIZED BY: eslint\\conf\\eslint-recommended.js
|
|
322
|
+
'no-shadow-restricted-names': 2,
|
|
323
|
+
// RATIONALE: Obsolete language feature that is deprecated.
|
|
324
|
+
// STANDARDIZED BY: eslint\\conf\\eslint-recommended.js
|
|
325
|
+
'no-sparse-arrays': 2,
|
|
326
|
+
// RATIONALE: Although in theory JavaScript allows any possible data type to be thrown as an exception,
|
|
327
|
+
// such flexibility adds pointless complexity, by requiring every catch block to test
|
|
328
|
+
// the type of the object that it receives. Whereas if catch blocks can always assume
|
|
329
|
+
// that their object implements the "Error" contract, then the code is simpler, and
|
|
330
|
+
// we generally get useful additional information like a call stack.
|
|
331
|
+
'no-throw-literal': 2,
|
|
332
|
+
// RATIONALE: Catches a common coding mistake.
|
|
333
|
+
'no-unmodified-loop-condition': 1,
|
|
334
|
+
// STANDARDIZED BY: eslint\\conf\\eslint-recommended.js
|
|
335
|
+
'no-unsafe-finally': 2,
|
|
336
|
+
// RATIONALE: Catches a common coding mistake.
|
|
337
|
+
'no-unused-expressions': 1,
|
|
338
|
+
// STANDARDIZED BY: eslint\\conf\\eslint-recommended.js
|
|
339
|
+
'no-unused-labels': 1,
|
|
340
|
+
// STANDARDIZED BY: eslint\\conf\\eslint-recommended.js
|
|
341
|
+
'no-useless-catch': 1,
|
|
342
|
+
// RATIONALE: Avoids a potential performance problem.
|
|
343
|
+
'no-useless-concat': 1,
|
|
344
|
+
// RATIONALE: The "var" keyword is deprecated because of its confusing "hoisting" behavior.
|
|
345
|
+
// Always use "let" or "const" instead.
|
|
346
|
+
//
|
|
347
|
+
// STANDARDIZED BY: @typescript-eslint\\eslint-plugin\\dist\\configs\\recommended.json
|
|
348
|
+
'no-var': 2,
|
|
349
|
+
// RATIONALE: Generally not needed in modern code.
|
|
350
|
+
'no-void': 1,
|
|
351
|
+
// RATIONALE: Obsolete language feature that is deprecated.
|
|
352
|
+
// STANDARDIZED BY: eslint\\conf\\eslint-recommended.js
|
|
353
|
+
'no-with': 2,
|
|
354
|
+
// RATIONALE: Makes logic easier to understand, since constants always have a known value
|
|
355
|
+
// @typescript-eslint\eslint-plugin\dist\configs\eslint-recommended.js
|
|
356
|
+
'prefer-const': 1,
|
|
357
|
+
// RATIONALE: Catches a common coding mistake where "resolve" and "reject" are confused.
|
|
358
|
+
'promise/param-names': 2,
|
|
359
|
+
// RATIONALE: Catches code that is likely to be incorrect
|
|
360
|
+
// STANDARDIZED BY: eslint\\conf\\eslint-recommended.js
|
|
361
|
+
'require-atomic-updates': 2,
|
|
362
|
+
// STANDARDIZED BY: eslint\\conf\\eslint-recommended.js
|
|
363
|
+
'require-yield': 1,
|
|
364
|
+
// "Use strict" is redundant when using the TypeScript compiler.
|
|
365
|
+
'strict': [
|
|
366
|
+
2,
|
|
367
|
+
'never'
|
|
368
|
+
],
|
|
369
|
+
// RATIONALE: Catches code that is likely to be incorrect
|
|
370
|
+
// STANDARDIZED BY: eslint\\conf\\eslint-recommended.js
|
|
371
|
+
'use-isnan': 2,
|
|
372
|
+
// STANDARDIZED BY: eslint\\conf\\eslint-recommended.js
|
|
373
|
+
// Set to 1 (warning) or 2 (error) to enable.
|
|
374
|
+
// Rationale to disable: !!{}
|
|
375
|
+
'no-extra-boolean-cast': 0,
|
|
376
|
+
// ====================================================================
|
|
377
|
+
// @microsoft/eslint-plugin-spfx
|
|
378
|
+
// ====================================================================
|
|
379
|
+
'@microsoft/spfx/import-requires-chunk-name': 1,
|
|
380
|
+
'@microsoft/spfx/no-require-ensure': 2,
|
|
381
|
+
'@microsoft/spfx/pair-react-dom-render-unmount': 1
|
|
382
|
+
}
|
|
383
|
+
},
|
|
384
|
+
{
|
|
385
|
+
// For unit tests, we can be a little bit less strict. The settings below revise the
|
|
386
|
+
// defaults specified in the extended configurations, as well as above.
|
|
387
|
+
files: [
|
|
388
|
+
// Test files
|
|
389
|
+
'*.test.ts',
|
|
390
|
+
'*.test.tsx',
|
|
391
|
+
'*.spec.ts',
|
|
392
|
+
'*.spec.tsx',
|
|
393
|
+
|
|
394
|
+
// Facebook convention
|
|
395
|
+
'**/__mocks__/*.ts',
|
|
396
|
+
'**/__mocks__/*.tsx',
|
|
397
|
+
'**/__tests__/*.ts',
|
|
398
|
+
'**/__tests__/*.tsx',
|
|
399
|
+
|
|
400
|
+
// Microsoft convention
|
|
401
|
+
'**/test/*.ts',
|
|
402
|
+
'**/test/*.tsx'
|
|
403
|
+
],
|
|
404
|
+
rules: {
|
|
405
|
+
'no-new': 0,
|
|
406
|
+
'class-name': 0,
|
|
407
|
+
'export-name': 0,
|
|
408
|
+
forin: 0,
|
|
409
|
+
'label-position': 0,
|
|
410
|
+
'member-access': 2,
|
|
411
|
+
'no-arg': 0,
|
|
412
|
+
'no-console': 0,
|
|
413
|
+
'no-construct': 0,
|
|
414
|
+
'no-duplicate-variable': 2,
|
|
415
|
+
'no-eval': 0,
|
|
416
|
+
'no-function-expression': 2,
|
|
417
|
+
'no-internal-module': 2,
|
|
418
|
+
'no-shadowed-variable': 2,
|
|
419
|
+
'no-switch-case-fall-through': 2,
|
|
420
|
+
'no-unnecessary-semicolons': 2,
|
|
421
|
+
'no-unused-expression': 2,
|
|
422
|
+
'no-with-statement': 2,
|
|
423
|
+
semicolon: 2,
|
|
424
|
+
'trailing-comma': 0,
|
|
425
|
+
typedef: 0,
|
|
426
|
+
'typedef-whitespace': 0,
|
|
427
|
+
'use-named-parameter': 2,
|
|
428
|
+
'variable-name': 0,
|
|
429
|
+
whitespace: 0
|
|
430
|
+
}
|
|
431
|
+
}`)
|
|
432
|
+
];
|
|
433
|
+
//# sourceMappingURL=upgrade-1.15.2.js.map
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const cli_1 = require("../../../../cli");
|
|
4
|
+
const request_1 = require("../../../../request");
|
|
5
|
+
const utils_1 = require("../../../../utils");
|
|
6
|
+
const SpoCommand_1 = require("../../../base/SpoCommand");
|
|
7
|
+
const commands_1 = require("../../commands");
|
|
8
|
+
const removeCommand = require('./file-remove');
|
|
9
|
+
class SpoFileRenameCommand extends SpoCommand_1.default {
|
|
10
|
+
get name() {
|
|
11
|
+
return commands_1.default.FILE_RENAME;
|
|
12
|
+
}
|
|
13
|
+
get description() {
|
|
14
|
+
return 'Renames a file';
|
|
15
|
+
}
|
|
16
|
+
getTelemetryProperties(args) {
|
|
17
|
+
const telemetryProps = super.getTelemetryProperties(args);
|
|
18
|
+
telemetryProps.force = !!args.options.force;
|
|
19
|
+
return telemetryProps;
|
|
20
|
+
}
|
|
21
|
+
commandAction(logger, args, cb) {
|
|
22
|
+
const webUrl = args.options.webUrl;
|
|
23
|
+
const originalFileServerRelativeUrl = utils_1.urlUtil.getServerRelativePath(args.options.webUrl, args.options.sourceUrl);
|
|
24
|
+
this
|
|
25
|
+
.getFile(originalFileServerRelativeUrl, webUrl)
|
|
26
|
+
.then((_) => {
|
|
27
|
+
if (args.options.force) {
|
|
28
|
+
return this.deleteFile(webUrl, args.options.sourceUrl, args.options.targetFileName);
|
|
29
|
+
}
|
|
30
|
+
return Promise.resolve();
|
|
31
|
+
})
|
|
32
|
+
.then(_ => {
|
|
33
|
+
const requestBody = {
|
|
34
|
+
formValues: [{
|
|
35
|
+
FieldName: 'FileLeafRef',
|
|
36
|
+
FieldValue: args.options.targetFileName
|
|
37
|
+
}]
|
|
38
|
+
};
|
|
39
|
+
const requestOptions = {
|
|
40
|
+
url: `${webUrl}/_api/web/GetFileByServerRelativeUrl('${encodeURIComponent(originalFileServerRelativeUrl)}')/ListItemAllFields/ValidateUpdateListItem()`,
|
|
41
|
+
headers: {
|
|
42
|
+
'accept': 'application/json;odata=nometadata'
|
|
43
|
+
},
|
|
44
|
+
data: requestBody,
|
|
45
|
+
responseType: 'json'
|
|
46
|
+
};
|
|
47
|
+
return request_1.default.post(requestOptions);
|
|
48
|
+
})
|
|
49
|
+
.then((resp) => {
|
|
50
|
+
logger.log(resp.value);
|
|
51
|
+
cb();
|
|
52
|
+
}, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
|
|
53
|
+
}
|
|
54
|
+
getFile(originalFileServerRelativeUrl, webUrl) {
|
|
55
|
+
const requestUrl = `${webUrl}/_api/web/GetFileByServerRelativeUrl('${encodeURIComponent(originalFileServerRelativeUrl)}')?$select=UniqueId`;
|
|
56
|
+
const requestOptions = {
|
|
57
|
+
url: requestUrl,
|
|
58
|
+
headers: {
|
|
59
|
+
'accept': 'application/json;odata=nometadata'
|
|
60
|
+
},
|
|
61
|
+
responseType: 'json'
|
|
62
|
+
};
|
|
63
|
+
return request_1.default.get(requestOptions);
|
|
64
|
+
}
|
|
65
|
+
deleteFile(webUrl, sourceUrl, targetFileName) {
|
|
66
|
+
const targetFileServerRelativeUrl = `${utils_1.urlUtil.getServerRelativePath(webUrl, sourceUrl.substring(0, sourceUrl.lastIndexOf('/')))}/${targetFileName}`;
|
|
67
|
+
const options = {
|
|
68
|
+
webUrl: webUrl,
|
|
69
|
+
url: targetFileServerRelativeUrl,
|
|
70
|
+
recycle: true,
|
|
71
|
+
confirm: true,
|
|
72
|
+
debug: this.debug,
|
|
73
|
+
verbose: this.verbose
|
|
74
|
+
};
|
|
75
|
+
return cli_1.Cli.executeCommandWithOutput(removeCommand, { options: Object.assign(Object.assign({}, options), { _: [] }) })
|
|
76
|
+
.then(_ => {
|
|
77
|
+
return Promise.resolve();
|
|
78
|
+
}, (err) => {
|
|
79
|
+
if (err.error !== null && err.error.message !== null && err.error.message.includes('does not exist')) {
|
|
80
|
+
return Promise.resolve();
|
|
81
|
+
}
|
|
82
|
+
return Promise.reject(err);
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
options() {
|
|
86
|
+
const options = [
|
|
87
|
+
{
|
|
88
|
+
option: '-u, --webUrl <webUrl>'
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
option: '-s, --sourceUrl <sourceUrl>'
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
option: '-t, --targetFileName <targetFileName>'
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
option: '--force'
|
|
98
|
+
}
|
|
99
|
+
];
|
|
100
|
+
const parentOptions = super.options();
|
|
101
|
+
return options.concat(parentOptions);
|
|
102
|
+
}
|
|
103
|
+
validate(args) {
|
|
104
|
+
return utils_1.validation.isValidSharePointUrl(args.options.webUrl);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
module.exports = new SpoFileRenameCommand();
|
|
108
|
+
//# sourceMappingURL=file-rename.js.map
|
|
@@ -15,6 +15,7 @@ class SpoGroupGetCommand extends SpoCommand_1.default {
|
|
|
15
15
|
const telemetryProps = super.getTelemetryProperties(args);
|
|
16
16
|
telemetryProps.id = (!(!args.options.id)).toString();
|
|
17
17
|
telemetryProps.name = (!(!args.options.name)).toString();
|
|
18
|
+
telemetryProps.associatedGroup = args.options.associatedGroup;
|
|
18
19
|
return telemetryProps;
|
|
19
20
|
}
|
|
20
21
|
commandAction(logger, args, cb) {
|
|
@@ -28,6 +29,19 @@ class SpoGroupGetCommand extends SpoCommand_1.default {
|
|
|
28
29
|
else if (args.options.name) {
|
|
29
30
|
requestUrl = `${args.options.webUrl}/_api/web/sitegroups/GetByName('${encodeURIComponent(args.options.name)}')`;
|
|
30
31
|
}
|
|
32
|
+
else if (args.options.associatedGroup) {
|
|
33
|
+
switch (args.options.associatedGroup.toLowerCase()) {
|
|
34
|
+
case 'owner':
|
|
35
|
+
requestUrl = `${args.options.webUrl}/_api/web/AssociatedOwnerGroup`;
|
|
36
|
+
break;
|
|
37
|
+
case 'member':
|
|
38
|
+
requestUrl = `${args.options.webUrl}/_api/web/AssociatedMemberGroup`;
|
|
39
|
+
break;
|
|
40
|
+
case 'visitor':
|
|
41
|
+
requestUrl = `${args.options.webUrl}/_api/web/AssociatedVisitorGroup`;
|
|
42
|
+
break;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
31
45
|
const requestOptions = {
|
|
32
46
|
url: requestUrl,
|
|
33
47
|
method: 'GET',
|
|
@@ -53,21 +67,27 @@ class SpoGroupGetCommand extends SpoCommand_1.default {
|
|
|
53
67
|
},
|
|
54
68
|
{
|
|
55
69
|
option: '--name [name]'
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
option: '--associatedGroup [associatedGroup]',
|
|
73
|
+
autocomplete: ['Owner', 'Member', 'Visitor']
|
|
56
74
|
}
|
|
57
75
|
];
|
|
58
76
|
const parentOptions = super.options();
|
|
59
77
|
return options.concat(parentOptions);
|
|
60
78
|
}
|
|
79
|
+
optionSets() {
|
|
80
|
+
return [
|
|
81
|
+
['id', 'name', 'associatedGroup']
|
|
82
|
+
];
|
|
83
|
+
}
|
|
61
84
|
validate(args) {
|
|
62
|
-
if (args.options.id && args.options.name) {
|
|
63
|
-
return 'Use either "id" or "name", but not all.';
|
|
64
|
-
}
|
|
65
|
-
if (!args.options.id && !args.options.name) {
|
|
66
|
-
return 'Specify id or name, one is required';
|
|
67
|
-
}
|
|
68
85
|
if (args.options.id && isNaN(args.options.id)) {
|
|
69
86
|
return `Specified id ${args.options.id} is not a number`;
|
|
70
87
|
}
|
|
88
|
+
if (args.options.associatedGroup && ['owner', 'member', 'visitor'].indexOf(args.options.associatedGroup.toLowerCase()) === -1) {
|
|
89
|
+
return `${args.options.associatedGroup} is not a valid associatedGroup value. Allowed values are Owner|Member|Visitor.`;
|
|
90
|
+
}
|
|
71
91
|
return utils_1.validation.isValidSharePointUrl(args.options.webUrl);
|
|
72
92
|
}
|
|
73
93
|
}
|
|
@@ -73,7 +73,7 @@ class SpoSiteAppPermissionAddCommand extends GraphCommand_1.default {
|
|
|
73
73
|
}
|
|
74
74
|
mapRequestBody(permission, appInfo) {
|
|
75
75
|
const requestBody = {
|
|
76
|
-
roles: permission
|
|
76
|
+
roles: [permission]
|
|
77
77
|
};
|
|
78
78
|
requestBody.grantedToIdentities = [];
|
|
79
79
|
requestBody.grantedToIdentities.push({ application: { "id": appInfo.appId, "displayName": appInfo.displayName } });
|
|
@@ -129,11 +129,8 @@ class SpoSiteAppPermissionAddCommand extends GraphCommand_1.default {
|
|
|
129
129
|
if (args.options.appId && !utils_1.validation.isValidGuid(args.options.appId)) {
|
|
130
130
|
return `${args.options.appId} is not a valid GUID`;
|
|
131
131
|
}
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
if (['read', 'write'].indexOf(permissions[i]) === -1) {
|
|
135
|
-
return `${permissions[i]} is not a valid permission value. Allowed values read|write|read,write`;
|
|
136
|
-
}
|
|
132
|
+
if (['read', 'write', 'owner'].indexOf(args.options.permission) === -1) {
|
|
133
|
+
return `${args.options.permission} is not a valid permission value. Allowed values are read|write|owner`;
|
|
137
134
|
}
|
|
138
135
|
return utils_1.validation.isValidSharePointUrl(args.options.siteUrl);
|
|
139
136
|
}
|
|
@@ -83,7 +83,7 @@ class SpoSiteAppPermissionSetCommand extends GraphCommand_1.default {
|
|
|
83
83
|
'content-type': 'application/json;odata=nometadata'
|
|
84
84
|
},
|
|
85
85
|
data: {
|
|
86
|
-
roles: args.options.permission
|
|
86
|
+
roles: [args.options.permission]
|
|
87
87
|
},
|
|
88
88
|
responseType: 'json'
|
|
89
89
|
};
|
|
@@ -122,11 +122,8 @@ class SpoSiteAppPermissionSetCommand extends GraphCommand_1.default {
|
|
|
122
122
|
if (args.options.appId && !utils_1.validation.isValidGuid(args.options.appId)) {
|
|
123
123
|
return `${args.options.appId} is not a valid GUID`;
|
|
124
124
|
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
if (['read', 'write'].indexOf(permissions[i]) === -1) {
|
|
128
|
-
return `${permissions[i]} is not a valid permission value. Allowed values are read|write|read,write`;
|
|
129
|
-
}
|
|
125
|
+
if (['read', 'write', 'owner'].indexOf(args.options.permission) === -1) {
|
|
126
|
+
return `${args.options.permission} is not a valid permission value. Allowed values are read|write|owner`;
|
|
130
127
|
}
|
|
131
128
|
return utils_1.validation.isValidSharePointUrl(args.options.siteUrl);
|
|
132
129
|
}
|
|
@@ -54,6 +54,7 @@ exports.default = {
|
|
|
54
54
|
FILE_LIST: `${prefix} file list`,
|
|
55
55
|
FILE_MOVE: `${prefix} file move`,
|
|
56
56
|
FILE_REMOVE: `${prefix} file remove`,
|
|
57
|
+
FILE_RENAME: `${prefix} file rename`,
|
|
57
58
|
FILE_SHARINGINFO_GET: `${prefix} file sharinginfo get`,
|
|
58
59
|
FOLDER_ADD: `${prefix} folder add`,
|
|
59
60
|
FOLDER_COPY: `${prefix} folder copy`,
|
|
@@ -32,7 +32,7 @@ m365 spfx project upgrade [options]
|
|
|
32
32
|
|
|
33
33
|
## Remarks
|
|
34
34
|
|
|
35
|
-
The `spfx project upgrade` command helps you upgrade your SharePoint Framework project to the specified version. If no version is specified, the command will upgrade to the latest version of the SharePoint Framework it supports (v1.15.
|
|
35
|
+
The `spfx project upgrade` command helps you upgrade your SharePoint Framework project to the specified version. If no version is specified, the command will upgrade to the latest version of the SharePoint Framework it supports (v1.15.2).
|
|
36
36
|
|
|
37
37
|
This command doesn't change your project files. Instead, it gives you a report with all steps necessary to upgrade your project to the specified version of the SharePoint Framework. Changing project files is error-prone, especially when it comes to updating your solution's code. This is why at this moment, this command produces a report that you can use yourself to perform the necessary updates and verify that everything is working as expected.
|
|
38
38
|
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# spo file rename
|
|
2
|
+
|
|
3
|
+
Renames a file
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
m365 spo file rename [options]
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Options
|
|
12
|
+
|
|
13
|
+
`-u, --webUrl <webUrl>`
|
|
14
|
+
: The URL of the site where the file is located
|
|
15
|
+
|
|
16
|
+
`-s, --sourceUrl <sourceUrl>`
|
|
17
|
+
: Site-relative URL of the file to rename
|
|
18
|
+
|
|
19
|
+
`-t, --targetFileName <targetFileName>`
|
|
20
|
+
: New file name of the file
|
|
21
|
+
|
|
22
|
+
`--force`
|
|
23
|
+
: If a file already exists with target file name, it will be moved to the recycle bin. If omitted, the rename operation will be canceled if a file already exists with the specified file name
|
|
24
|
+
|
|
25
|
+
--8<-- "docs/cmd/_global.md"
|
|
26
|
+
|
|
27
|
+
## Remarks
|
|
28
|
+
|
|
29
|
+
If you try to rename a file without the `--force` flag and a file with this name already exists, the operation will be cancelled.
|
|
30
|
+
|
|
31
|
+
## Examples
|
|
32
|
+
|
|
33
|
+
Renames a file with server-relative URL _/Shared Documents/Test1.docx_ located in site _<https://contoso.sharepoint.com/sites/project-x>_ to _Test2.docx_
|
|
34
|
+
|
|
35
|
+
```sh
|
|
36
|
+
m365 spo file rename --webUrl https://contoso.sharepoint.com/sites/project-x --sourceUrl '/Shared Documents/Test1.docx' --targetFileName 'Test2.docx'
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Renames a file with server-relative URL _/Shared Documents/Test1.docx_ located in site _<https://contoso.sharepoint.com/sites/project-x>_ to _Test2.docx_. If the file with the target file name already exists, this file will be moved to the recycle bin
|
|
40
|
+
|
|
41
|
+
```sh
|
|
42
|
+
m365 spo file rename --webUrl https://contoso.sharepoint.com/sites/project-x --sourceUrl '/Shared Documents/Test1.docx' --targetFileName 'Test2.docx' --force
|
|
43
|
+
```
|
|
@@ -11,13 +11,16 @@ m365 spo group get [options]
|
|
|
11
11
|
## Options
|
|
12
12
|
|
|
13
13
|
`-u, --webUrl <webUrl>`
|
|
14
|
-
: URL of the site where the group is located
|
|
14
|
+
: URL of the site where the group is located.
|
|
15
15
|
|
|
16
16
|
`-i, --id [id]`
|
|
17
|
-
: ID of the site group to get. Use either `id` or `
|
|
17
|
+
: ID of the site group to get. Use either `id`, `name` or `associatedGroup` but not multiple.
|
|
18
18
|
|
|
19
19
|
`--name [name]`
|
|
20
|
-
: Name of the site group to get.
|
|
20
|
+
: Name of the site group to get. Use either `id`, `name` or `associatedGroup` but not multiple.
|
|
21
|
+
|
|
22
|
+
`--associatedGroup [associatedGroup]`
|
|
23
|
+
: Type of the associated group to get. Available values: `Owner`, `Member`, `Visitor`. Use either `id`, `name` or `associatedGroup` but not multiple.
|
|
21
24
|
|
|
22
25
|
--8<-- "docs/cmd/_global.md"
|
|
23
26
|
|
|
@@ -34,3 +37,9 @@ Get group with name _Team Site Members_ for web _https://contoso.sharepoint.com/
|
|
|
34
37
|
```sh
|
|
35
38
|
m365 spo group get --webUrl https://contoso.sharepoint.com/sites/project-x --name "Team Site Members"
|
|
36
39
|
```
|
|
40
|
+
|
|
41
|
+
Get the associated owner group of a specified site
|
|
42
|
+
|
|
43
|
+
```sh
|
|
44
|
+
m365 spo group get --webUrl https://contoso.sharepoint.com/sites/project-x --associatedGroup Owner
|
|
45
|
+
```
|
|
@@ -14,7 +14,7 @@ m365 spo site apppermission add [options]
|
|
|
14
14
|
: URL of the site collection to add the permission
|
|
15
15
|
|
|
16
16
|
`-p, --permission <permission>`
|
|
17
|
-
: Permission to site (`read`, `write`, `
|
|
17
|
+
: Permission to site (`read`, `write`, or `owner`)
|
|
18
18
|
|
|
19
19
|
`-i, --appId [appId]`
|
|
20
20
|
: Client ID of the Azure AD app for which to grant permissions
|
|
@@ -23,7 +23,7 @@ m365 spo site apppermission set [options]
|
|
|
23
23
|
: Display name of the Azure AD app for which to update permissions. Specify `permissionId`, `appId` or `appDisplayName`
|
|
24
24
|
|
|
25
25
|
`-p, --permission <permission>`
|
|
26
|
-
: Permission to site (`read`, `write`, `
|
|
26
|
+
: Permission to site (`read`, `write`, or `owner`)
|
|
27
27
|
|
|
28
28
|
--8<-- "docs/cmd/_global.md"
|
|
29
29
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pnp/cli-microsoft365",
|
|
3
|
-
"version": "5.6.0
|
|
3
|
+
"version": "5.6.0",
|
|
4
4
|
"description": "Manage Microsoft 365 and SharePoint Framework projects on any platform",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "./dist/api.js",
|
|
@@ -239,4 +239,4 @@
|
|
|
239
239
|
"sinon": "^14.0.0",
|
|
240
240
|
"source-map-support": "^0.5.21"
|
|
241
241
|
}
|
|
242
|
-
}
|
|
242
|
+
}
|