X Tutup
Skip to content

Commit 4d18946

Browse files
committed
Fix ESLint issues for rush-lib
1 parent 1007ef3 commit 4d18946

File tree

67 files changed

+178
-166
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+178
-166
lines changed

apps/rush-lib/src/api/ApprovedPackagesConfiguration.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,8 @@ export class ApprovedPackagesConfiguration {
136136
// Update the JSON structure that we already loaded, preserving any existing state
137137
// (which passed schema validation).
138138

139-
this._loadedJson.$schema = JsonSchemaUrls.approvedPackages,
139+
// eslint-disable-next-line dot-notation
140+
this._loadedJson['$schema'] = JsonSchemaUrls.approvedPackages;
140141

141142
this._loadedJson.packages = [];
142143

apps/rush-lib/src/api/EnvironmentConfiguration.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ export class EnvironmentConfiguration {
178178
const endsWithSlash: boolean = folderPath.charAt(folderPath.length - 1) === path.sep;
179179
const parsedPath: path.ParsedPath = path.parse(folderPath);
180180
const pathRoot: string = parsedPath.root;
181-
const pathWithoutRoot: String = parsedPath.dir.substr(pathRoot.length);
181+
const pathWithoutRoot: string = parsedPath.dir.substr(pathRoot.length);
182182
const pathParts: string[] = [...pathWithoutRoot.split(path.sep), parsedPath.name].filter((part) => !!part);
183183

184184
// Starting with all path sections, and eliminating one from the end during each loop iteration,

apps/rush-lib/src/api/LastInstallFlag.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as path from 'path';
22
import * as _ from 'lodash';
3-
import { FileSystem, JsonFile } from '@microsoft/node-core-library';
3+
import { FileSystem, JsonFile, JsonObject } from '@microsoft/node-core-library';
44

55
export const LAST_INSTALL_FLAG_FILE_NAME: string = 'last-install.flag';
66

@@ -13,14 +13,14 @@ export const LAST_INSTALL_FLAG_FILE_NAME: string = 'last-install.flag';
1313
*/
1414
export class LastInstallFlag {
1515
private _path: string;
16-
private _state: Object;
16+
private _state: JsonObject;
1717

1818
/**
1919
* Creates a new LastInstall flag
2020
* @param folderPath - the folder that this flag is managing
2121
* @param state - optional, the state that should be managed or compared
2222
*/
23-
constructor(folderPath: string, state: Object = {}) {
23+
public constructor(folderPath: string, state: JsonObject = {}) {
2424
this._path = path.join(folderPath, LAST_INSTALL_FLAG_FILE_NAME);
2525
this._state = state;
2626
}
@@ -33,7 +33,7 @@ export class LastInstallFlag {
3333
return false;
3434
}
3535
try {
36-
const contents: Object = JsonFile.load(this._path);
36+
const contents: JsonObject = JsonFile.load(this._path);
3737
return _.isEqual(contents, this._state);
3838
} catch (error) {
3939
return false;

apps/rush-lib/src/api/RushConfiguration.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
22
// See LICENSE in the project root for license information.
33

4+
/* eslint max-lines: off */
5+
46
import * as path from 'path';
57
import * as fs from 'fs';
68
import * as semver from 'semver';

apps/rush-lib/src/api/RushConfigurationProject.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export class RushConfigurationProject {
5252
private readonly _rushConfiguration: RushConfiguration;
5353

5454
/** @internal */
55-
constructor(
55+
public constructor(
5656
projectJson: IRushConfigurationProjectJson,
5757
rushConfiguration: RushConfiguration,
5858
tempProjectName: string

apps/rush-lib/src/api/Variants.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ import {
66
/**
77
* Namespace for utilities relating to the Variants feature.
88
*/
9-
export namespace Variants {
9+
export class Variants {
1010
/**
1111
* Provides the parameter configuration for '--variant'.
1212
*/
13-
export const VARIANT_PARAMETER: ICommandLineStringDefinition = {
13+
public static readonly VARIANT_PARAMETER: ICommandLineStringDefinition = {
1414
parameterLongName: '--variant',
1515
argumentName: 'VARIANT',
1616
description: 'Run command using a variant installation configuration',

apps/rush-lib/src/api/VersionPolicy.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ export abstract class VersionPolicy {
7878
/**
7979
* @internal
8080
*/
81-
constructor(versionPolicyJson: IVersionPolicyJson) {
81+
public constructor(versionPolicyJson: IVersionPolicyJson) {
8282
this._policyName = versionPolicyJson.policyName;
8383
this._definitionName = VersionPolicyDefinitionName[versionPolicyJson.definitionName];
8484
this._exemptFromRushChange = versionPolicyJson.exemptFromRushChange || false;
@@ -210,7 +210,7 @@ export class LockStepVersionPolicy extends VersionPolicy {
210210
/**
211211
* @internal
212212
*/
213-
constructor(versionPolicyJson: ILockStepVersionJson) {
213+
public constructor(versionPolicyJson: ILockStepVersionJson) {
214214
super(versionPolicyJson);
215215
this._version = new semver.SemVer(versionPolicyJson.version);
216216
this._nextBump = BumpType[versionPolicyJson.nextBump];
@@ -336,7 +336,7 @@ export class IndividualVersionPolicy extends VersionPolicy {
336336
/**
337337
* @internal
338338
*/
339-
constructor(versionPolicyJson: IIndividualVersionJson) {
339+
public constructor(versionPolicyJson: IIndividualVersionJson) {
340340
super(versionPolicyJson);
341341
this._lockedMajor = versionPolicyJson.lockedMajor;
342342
}

apps/rush-lib/src/api/test/EnvironmentConfiguration.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,22 +22,22 @@ describe('EnvironmentConfiguration', () => {
2222
});
2323

2424
it('allows known environment variables', () => {
25-
process.env['RUSH_TEMP_FOLDER'] = '/var/temp'; // tslint:disable-line:no-string-literal
25+
process.env['RUSH_TEMP_FOLDER'] = '/var/temp'; // eslint-disable-line dot-notation
2626
expect(EnvironmentConfiguration.initialize).not.toThrow();
2727
});
2828

2929
it('does not allow unknown environment variables', () => {
30-
process.env['rush_foobar'] = 'asdf'; // tslint:disable-line:no-string-literal
30+
process.env['rush_foobar'] = 'asdf'; // eslint-disable-line dot-notation
3131
expect(EnvironmentConfiguration.initialize).toThrow();
3232
});
3333

3434
it('can be re-initialized', () => {
35-
process.env['RUSH_TEMP_FOLDER'] = '/var/tempA'; // tslint:disable-line:no-string-literal
35+
process.env['RUSH_TEMP_FOLDER'] = '/var/tempA'; // eslint-disable-line dot-notation
3636
EnvironmentConfiguration.initialize({ doNotNormalizePaths: true });
3737

3838
expect(EnvironmentConfiguration.rushTempFolderOverride).toEqual('/var/tempA');
3939

40-
process.env['RUSH_TEMP_FOLDER'] = '/var/tempB'; // tslint:disable-line:no-string-literal
40+
process.env['RUSH_TEMP_FOLDER'] = '/var/tempB'; // eslint-disable-line dot-notation
4141
EnvironmentConfiguration.initialize({ doNotNormalizePaths: true });
4242

4343
expect(EnvironmentConfiguration.rushTempFolderOverride).toEqual('/var/tempB');
@@ -57,7 +57,7 @@ describe('EnvironmentConfiguration', () => {
5757

5858
it('returns the value for a set environment variable', () => {
5959
const expectedValue: string = '/var/temp';
60-
process.env['RUSH_TEMP_FOLDER'] = expectedValue; // tslint:disable-line:no-string-literal
60+
process.env['RUSH_TEMP_FOLDER'] = expectedValue; // eslint-disable-line dot-notation
6161
EnvironmentConfiguration.initialize({ doNotNormalizePaths: true });
6262

6363
expect(EnvironmentConfiguration.rushTempFolderOverride).toEqual(expectedValue);

apps/rush-lib/src/api/test/RushConfiguration.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ describe('RushConfiguration', () => {
2525
_oldEnv = process.env;
2626
process.env = {};
2727

28-
process.env['USERPROFILE'] = _oldEnv['USERPROFILE']; // tslint:disable-line:no-string-literal
29-
process.env['HOME'] = _oldEnv['HOME']; // tslint:disable-line:no-string-literal
28+
process.env['USERPROFILE'] = _oldEnv['USERPROFILE']; // eslint-disable-line dot-notation
29+
process.env['HOME'] = _oldEnv['HOME']; // eslint-disable-line dot-notation
3030
});
3131

3232
afterEach(() => {
@@ -192,7 +192,7 @@ describe('RushConfiguration', () => {
192192

193193
it('allows the temp directory to be set via environment variable', () => {
194194
const expectedValue: string = path.resolve('/var/temp');
195-
process.env['RUSH_TEMP_FOLDER'] = expectedValue; // tslint:disable-line:no-string-literal
195+
process.env['RUSH_TEMP_FOLDER'] = expectedValue; // eslint-disable-line dot-notation
196196

197197
const rushFilename: string = path.resolve(__dirname, 'repo', 'rush-pnpm.json');
198198
const rushConfiguration: RushConfiguration = RushConfiguration.loadFromConfigurationFile(rushFilename);

apps/rush-lib/src/api/test/VersionMismatchFinder.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { VersionMismatchFinderEntity } from '../../logic/versionMismatch/Version
1111
import { VersionMismatchFinderProject } from '../../logic/versionMismatch/VersionMismatchFinderProject';
1212
import { VersionMismatchFinderCommonVersions } from '../../logic/versionMismatch/VersionMismatchFinderCommonVersions';
1313

14-
// tslint:disable:no-any
14+
/* eslint-disable @typescript-eslint/no-explicit-any */
1515
describe('VersionMismatchFinder', () => {
1616
it('finds no mismatches if there are none', (done: jest.DoneCallback) => {
1717
const projectA: VersionMismatchFinderEntity = new VersionMismatchFinderProject({

0 commit comments

Comments
 (0)
X Tutup