Skip to content

Upgrade typescript-eslint version #39242

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,20 @@
"@typescript-eslint/array-type": "error",

"camelcase": "off",
"@typescript-eslint/camelcase": ["error", { "properties": "never", "allow": ["^[A-Za-z][a-zA-Za-z]+_[A-Za-z]+$"] }],
"@typescript-eslint/naming-convention": [
"error",
{ "selector": "typeLike", "format": ["PascalCase"], "filter": { "regex": "^(__String|[A-Za-z]+_[A-Za-z]+)$", "match": false } },
{ "selector": "interface", "format": ["PascalCase"], "custom": { "regex": "^I[A-Z]", "match": false }, "filter": { "regex": "^I(Arguments|TextWriter|O([A-Z][a-z]+[A-Za-z]*)?)$", "match": false } },
{ "selector": "variable", "format": ["camelCase", "PascalCase", "UPPER_CASE"], "leadingUnderscore": "allow", "filter": { "regex": "^(_{1,2}filename|_{1,2}dirname|_+|[A-Za-z]+_[A-Za-z]+)$", "match": false } },
{ "selector": "function", "format": ["camelCase", "PascalCase"], "leadingUnderscore": "allow", "filter": { "regex": "^[A-Za-z]+_[A-Za-z]+$", "match": false } },
{ "selector": "parameter", "format": ["camelCase"], "leadingUnderscore": "allow", "filter": { "regex": "^(_+|[A-Za-z]+_[A-Z][a-z]+)$", "match": false } },
{ "selector": "method", "format": ["camelCase", "PascalCase"], "leadingUnderscore": "allow", "filter": { "regex": "^[A-Za-z]+_[A-Za-z]+$", "match": false } },
{ "selector": "memberLike", "format": ["camelCase"], "leadingUnderscore": "allow", "filter": { "regex": "^[A-Za-z]+_[A-Za-z]+$", "match": false } },
{ "selector": "enumMember", "format": ["camelCase", "PascalCase"], "leadingUnderscore": "allow", "filter": { "regex": "^[A-Za-z]+_[A-Za-z]+$", "match": false } },
{ "selector": "property", "format": null }
],

"@typescript-eslint/class-name-casing": "error",
"@typescript-eslint/consistent-type-definitions": ["error", "interface"],
"@typescript-eslint/interface-name-prefix": "error",
"@typescript-eslint/no-inferrable-types": "error",
"@typescript-eslint/no-misused-new": "error",
"@typescript-eslint/no-this-alias": "error",
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@
"@types/through2": "latest",
"@types/travis-fold": "latest",
"@types/xml2js": "^0.4.0",
"@typescript-eslint/eslint-plugin": "2.27.0",
"@typescript-eslint/experimental-utils": "2.27.0",
"@typescript-eslint/parser": "2.27.0",
"@typescript-eslint/eslint-plugin": "^3.4.0",
"@typescript-eslint/experimental-utils": "^3.4.0",
"@typescript-eslint/parser": "^3.4.0",
"async": "latest",
"azure-devops-node-api": "^10.1.0",
"browser-resolve": "^1.11.2",
Expand Down Expand Up @@ -97,7 +97,7 @@
"source-map-support": "latest",
"through2": "latest",
"travis-fold": "latest",
"typescript": "^3.9.3",
"typescript": "^4.0.0-dev.20200624",
"vinyl": "latest",
"vinyl-sourcemaps-apply": "latest",
"xml2js": "^0.4.19"
Expand Down
1 change: 0 additions & 1 deletion src/harness/harnessIO.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
namespace Harness {
// eslint-disable-next-line @typescript-eslint/interface-name-prefix
export interface IO {
newLine(): string;
getCurrentDirectory(): string;
Expand Down
2 changes: 1 addition & 1 deletion src/server/typingsCache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace ts.server {
}

// for backwards-compatibility
// eslint-disable-next-line @typescript-eslint/interface-name-prefix
// eslint-disable-next-line @typescript-eslint/naming-convention
export interface ITypingsInstaller {
isKnownTypesPackageName(name: string): boolean;
installPackage(options: InstallPackageOptionsWithProject): Promise<ApplyCodeActionCommandResult>;
Expand Down
2 changes: 1 addition & 1 deletion src/services/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ namespace ts {
* snapshot is observably immutable. i.e. the same calls with the same parameters will return
* the same values.
*/
// eslint-disable-next-line @typescript-eslint/interface-name-prefix
// eslint-disable-next-line @typescript-eslint/naming-convention
export interface IScriptSnapshot {
/** Gets a portion of the script snapshot specified by [start, end). */
getText(start: number, end: number): string;
Expand Down
2 changes: 1 addition & 1 deletion src/testRunner/unittests/moduleResolution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1113,7 +1113,7 @@ import b = require("./moduleB");

function test(hasDirectoryExists: boolean) {
const file1: File = { name: "/root/folder1/file1.ts" };
const file1_1: File = { name: "/root/folder1/file1_1/index.d.ts" }; // eslint-disable-line @typescript-eslint/camelcase
const file1_1: File = { name: "/root/folder1/file1_1/index.d.ts" }; // eslint-disable-line @typescript-eslint/naming-convention
const file2: File = { name: "/root/generated/folder1/file2.ts" };
const file3: File = { name: "/root/generated/folder2/file3.ts" };
const host = createModuleResolutionHost(hasDirectoryExists, file1, file1_1, file2, file3);
Expand Down
34 changes: 17 additions & 17 deletions src/testRunner/unittests/tsbuild/amdModulesWithOut.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
namespace ts {
describe("unittests:: tsbuild:: outFile:: on amd modules with --out", () => {
let outFileFs: vfs.FileSystem;
const enum project { lib, app }
const enum Project { lib, app }
function relName(path: string) { return path.slice(1); }
type Sources = [string, readonly string[]];
const enum source { config, ts }
const enum Source { config, ts }
const sources: [Sources, Sources] = [
[
"/src/lib/tsconfig.json",
Expand Down Expand Up @@ -51,7 +51,7 @@ namespace ts {
incrementalScenarios: [
{
buildKind: BuildKind.IncrementalDtsUnchanged,
modifyFs: fs => appendText(fs, relName(sources[project.lib][source.ts][1]), "console.log(x);")
modifyFs: fs => appendText(fs, relName(sources[Project.lib][Source.ts][1]), "console.log(x);")
},
...(modifyAgainFs ? [{
buildKind: BuildKind.IncrementalHeadersChange,
Expand All @@ -71,15 +71,15 @@ namespace ts {
verifyOutFileScenario({
subScenario: "multiple prologues in all projects",
modifyFs: fs => {
enableStrict(fs, sources[project.lib][source.config]);
addTestPrologue(fs, sources[project.lib][source.ts][0], `"myPrologue"`);
addTestPrologue(fs, sources[project.lib][source.ts][2], `"myPrologueFile"`);
addTestPrologue(fs, sources[project.lib][source.ts][3], `"myPrologue3"`);
enableStrict(fs, sources[project.app][source.config]);
addTestPrologue(fs, sources[project.app][source.ts][0], `"myPrologue"`);
addTestPrologue(fs, sources[project.app][source.ts][1], `"myPrologue2";`);
enableStrict(fs, sources[Project.lib][Source.config]);
addTestPrologue(fs, sources[Project.lib][Source.ts][0], `"myPrologue"`);
addTestPrologue(fs, sources[Project.lib][Source.ts][2], `"myPrologueFile"`);
addTestPrologue(fs, sources[Project.lib][Source.ts][3], `"myPrologue3"`);
enableStrict(fs, sources[Project.app][Source.config]);
addTestPrologue(fs, sources[Project.app][Source.ts][0], `"myPrologue"`);
addTestPrologue(fs, sources[Project.app][Source.ts][1], `"myPrologue2";`);
},
modifyAgainFs: fs => addTestPrologue(fs, relName(sources[project.lib][source.ts][1]), `"myPrologue5"`)
modifyAgainFs: fs => addTestPrologue(fs, relName(sources[Project.lib][Source.ts][1]), `"myPrologue5"`)
});
});

Expand Down Expand Up @@ -125,10 +125,10 @@ namespace ts {
describe("stripInternal", () => {
function stripInternalScenario(fs: vfs.FileSystem) {
const internal = "/*@internal*/";
replaceText(fs, sources[project.app][source.config], `"composite": true,`, `"composite": true,
replaceText(fs, sources[Project.app][Source.config], `"composite": true,`, `"composite": true,
"stripInternal": true,`);
replaceText(fs, sources[project.lib][source.ts][0], "const", `${internal} const`);
appendText(fs, sources[project.lib][source.ts][1], `
replaceText(fs, sources[Project.lib][Source.ts][0], "const", `${internal} const`);
appendText(fs, sources[Project.lib][Source.ts][1], `
export class normalC {
${internal} constructor() { }
${internal} prop: string;
Expand Down Expand Up @@ -160,16 +160,16 @@ ${internal} export enum internalEnum { a, b, c }`);
verifyOutFileScenario({
subScenario: "stripInternal",
modifyFs: stripInternalScenario,
modifyAgainFs: fs => replaceText(fs, sources[project.lib][source.ts][1], `export const`, `/*@internal*/ export const`),
modifyAgainFs: fs => replaceText(fs, sources[Project.lib][Source.ts][1], `export const`, `/*@internal*/ export const`),
});
});

describe("when the module resolution finds original source file", () => {
function modifyFs(fs: vfs.FileSystem) {
// Make lib to output to parent dir
replaceText(fs, sources[project.lib][source.config], `"outFile": "module.js"`, `"outFile": "../module.js", "rootDir": "../"`);
replaceText(fs, sources[Project.lib][Source.config], `"outFile": "module.js"`, `"outFile": "../module.js", "rootDir": "../"`);
// Change reference to file1 module to resolve to lib/file1
replaceText(fs, sources[project.app][source.ts][0], "file1", "lib/file1");
replaceText(fs, sources[Project.app][Source.ts][0], "file1", "lib/file1");
}

verifyTsc({
Expand Down
Loading