Skip to content

Commit cc7cb9e

Browse files
authored
Upgrade typescript-eslint version (microsoft#39242)
* Upgrade typescript-eslint version * Update TS version used by typescript-eslint
1 parent a3ee09d commit cc7cb9e

File tree

8 files changed

+135
-127
lines changed

8 files changed

+135
-127
lines changed

.eslintrc.json

+12-3
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,20 @@
1818
"@typescript-eslint/array-type": "error",
1919

2020
"camelcase": "off",
21-
"@typescript-eslint/camelcase": ["error", { "properties": "never", "allow": ["^[A-Za-z][a-zA-Za-z]+_[A-Za-z]+$"] }],
21+
"@typescript-eslint/naming-convention": [
22+
"error",
23+
{ "selector": "typeLike", "format": ["PascalCase"], "filter": { "regex": "^(__String|[A-Za-z]+_[A-Za-z]+)$", "match": false } },
24+
{ "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 } },
25+
{ "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 } },
26+
{ "selector": "function", "format": ["camelCase", "PascalCase"], "leadingUnderscore": "allow", "filter": { "regex": "^[A-Za-z]+_[A-Za-z]+$", "match": false } },
27+
{ "selector": "parameter", "format": ["camelCase"], "leadingUnderscore": "allow", "filter": { "regex": "^(_+|[A-Za-z]+_[A-Z][a-z]+)$", "match": false } },
28+
{ "selector": "method", "format": ["camelCase", "PascalCase"], "leadingUnderscore": "allow", "filter": { "regex": "^[A-Za-z]+_[A-Za-z]+$", "match": false } },
29+
{ "selector": "memberLike", "format": ["camelCase"], "leadingUnderscore": "allow", "filter": { "regex": "^[A-Za-z]+_[A-Za-z]+$", "match": false } },
30+
{ "selector": "enumMember", "format": ["camelCase", "PascalCase"], "leadingUnderscore": "allow", "filter": { "regex": "^[A-Za-z]+_[A-Za-z]+$", "match": false } },
31+
{ "selector": "property", "format": null }
32+
],
2233

23-
"@typescript-eslint/class-name-casing": "error",
2434
"@typescript-eslint/consistent-type-definitions": ["error", "interface"],
25-
"@typescript-eslint/interface-name-prefix": "error",
2635
"@typescript-eslint/no-inferrable-types": "error",
2736
"@typescript-eslint/no-misused-new": "error",
2837
"@typescript-eslint/no-this-alias": "error",

package.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@
5454
"@types/through2": "latest",
5555
"@types/travis-fold": "latest",
5656
"@types/xml2js": "^0.4.0",
57-
"@typescript-eslint/eslint-plugin": "2.27.0",
58-
"@typescript-eslint/experimental-utils": "2.27.0",
59-
"@typescript-eslint/parser": "2.27.0",
57+
"@typescript-eslint/eslint-plugin": "^3.4.0",
58+
"@typescript-eslint/experimental-utils": "^3.4.0",
59+
"@typescript-eslint/parser": "^3.4.0",
6060
"async": "latest",
6161
"azure-devops-node-api": "^10.1.0",
6262
"browser-resolve": "^1.11.2",
@@ -97,7 +97,7 @@
9797
"source-map-support": "latest",
9898
"through2": "latest",
9999
"travis-fold": "latest",
100-
"typescript": "^3.9.3",
100+
"typescript": "^4.0.0-dev.20200624",
101101
"vinyl": "latest",
102102
"vinyl-sourcemaps-apply": "latest",
103103
"xml2js": "^0.4.19"

src/harness/harnessIO.ts

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
namespace Harness {
2-
// eslint-disable-next-line @typescript-eslint/interface-name-prefix
32
export interface IO {
43
newLine(): string;
54
getCurrentDirectory(): string;

src/server/typingsCache.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ namespace ts.server {
55
}
66

77
// for backwards-compatibility
8-
// eslint-disable-next-line @typescript-eslint/interface-name-prefix
8+
// eslint-disable-next-line @typescript-eslint/naming-convention
99
export interface ITypingsInstaller {
1010
isKnownTypesPackageName(name: string): boolean;
1111
installPackage(options: InstallPackageOptionsWithProject): Promise<ApplyCodeActionCommandResult>;

src/services/types.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ namespace ts {
116116
* snapshot is observably immutable. i.e. the same calls with the same parameters will return
117117
* the same values.
118118
*/
119-
// eslint-disable-next-line @typescript-eslint/interface-name-prefix
119+
// eslint-disable-next-line @typescript-eslint/naming-convention
120120
export interface IScriptSnapshot {
121121
/** Gets a portion of the script snapshot specified by [start, end). */
122122
getText(start: number, end: number): string;

src/testRunner/unittests/moduleResolution.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1113,7 +1113,7 @@ import b = require("./moduleB");
11131113

11141114
function test(hasDirectoryExists: boolean) {
11151115
const file1: File = { name: "/root/folder1/file1.ts" };
1116-
const file1_1: File = { name: "/root/folder1/file1_1/index.d.ts" }; // eslint-disable-line @typescript-eslint/camelcase
1116+
const file1_1: File = { name: "/root/folder1/file1_1/index.d.ts" }; // eslint-disable-line @typescript-eslint/naming-convention
11171117
const file2: File = { name: "/root/generated/folder1/file2.ts" };
11181118
const file3: File = { name: "/root/generated/folder2/file3.ts" };
11191119
const host = createModuleResolutionHost(hasDirectoryExists, file1, file1_1, file2, file3);

src/testRunner/unittests/tsbuild/amdModulesWithOut.ts

+17-17
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
namespace ts {
22
describe("unittests:: tsbuild:: outFile:: on amd modules with --out", () => {
33
let outFileFs: vfs.FileSystem;
4-
const enum project { lib, app }
4+
const enum Project { lib, app }
55
function relName(path: string) { return path.slice(1); }
66
type Sources = [string, readonly string[]];
7-
const enum source { config, ts }
7+
const enum Source { config, ts }
88
const sources: [Sources, Sources] = [
99
[
1010
"/src/lib/tsconfig.json",
@@ -51,7 +51,7 @@ namespace ts {
5151
incrementalScenarios: [
5252
{
5353
buildKind: BuildKind.IncrementalDtsUnchanged,
54-
modifyFs: fs => appendText(fs, relName(sources[project.lib][source.ts][1]), "console.log(x);")
54+
modifyFs: fs => appendText(fs, relName(sources[Project.lib][Source.ts][1]), "console.log(x);")
5555
},
5656
...(modifyAgainFs ? [{
5757
buildKind: BuildKind.IncrementalHeadersChange,
@@ -71,15 +71,15 @@ namespace ts {
7171
verifyOutFileScenario({
7272
subScenario: "multiple prologues in all projects",
7373
modifyFs: fs => {
74-
enableStrict(fs, sources[project.lib][source.config]);
75-
addTestPrologue(fs, sources[project.lib][source.ts][0], `"myPrologue"`);
76-
addTestPrologue(fs, sources[project.lib][source.ts][2], `"myPrologueFile"`);
77-
addTestPrologue(fs, sources[project.lib][source.ts][3], `"myPrologue3"`);
78-
enableStrict(fs, sources[project.app][source.config]);
79-
addTestPrologue(fs, sources[project.app][source.ts][0], `"myPrologue"`);
80-
addTestPrologue(fs, sources[project.app][source.ts][1], `"myPrologue2";`);
74+
enableStrict(fs, sources[Project.lib][Source.config]);
75+
addTestPrologue(fs, sources[Project.lib][Source.ts][0], `"myPrologue"`);
76+
addTestPrologue(fs, sources[Project.lib][Source.ts][2], `"myPrologueFile"`);
77+
addTestPrologue(fs, sources[Project.lib][Source.ts][3], `"myPrologue3"`);
78+
enableStrict(fs, sources[Project.app][Source.config]);
79+
addTestPrologue(fs, sources[Project.app][Source.ts][0], `"myPrologue"`);
80+
addTestPrologue(fs, sources[Project.app][Source.ts][1], `"myPrologue2";`);
8181
},
82-
modifyAgainFs: fs => addTestPrologue(fs, relName(sources[project.lib][source.ts][1]), `"myPrologue5"`)
82+
modifyAgainFs: fs => addTestPrologue(fs, relName(sources[Project.lib][Source.ts][1]), `"myPrologue5"`)
8383
});
8484
});
8585

@@ -125,10 +125,10 @@ namespace ts {
125125
describe("stripInternal", () => {
126126
function stripInternalScenario(fs: vfs.FileSystem) {
127127
const internal = "/*@internal*/";
128-
replaceText(fs, sources[project.app][source.config], `"composite": true,`, `"composite": true,
128+
replaceText(fs, sources[Project.app][Source.config], `"composite": true,`, `"composite": true,
129129
"stripInternal": true,`);
130-
replaceText(fs, sources[project.lib][source.ts][0], "const", `${internal} const`);
131-
appendText(fs, sources[project.lib][source.ts][1], `
130+
replaceText(fs, sources[Project.lib][Source.ts][0], "const", `${internal} const`);
131+
appendText(fs, sources[Project.lib][Source.ts][1], `
132132
export class normalC {
133133
${internal} constructor() { }
134134
${internal} prop: string;
@@ -160,16 +160,16 @@ ${internal} export enum internalEnum { a, b, c }`);
160160
verifyOutFileScenario({
161161
subScenario: "stripInternal",
162162
modifyFs: stripInternalScenario,
163-
modifyAgainFs: fs => replaceText(fs, sources[project.lib][source.ts][1], `export const`, `/*@internal*/ export const`),
163+
modifyAgainFs: fs => replaceText(fs, sources[Project.lib][Source.ts][1], `export const`, `/*@internal*/ export const`),
164164
});
165165
});
166166

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

175175
verifyTsc({

0 commit comments

Comments
 (0)