Skip to content

Commit 3c2c181

Browse files
committed
add eslint
1 parent 74c6bc1 commit 3c2c181

18 files changed

+147
-734
lines changed

.eslintignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/built/local/**
2+
/tests/**
3+
/lib/**

.eslintrc

+121
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
{
2+
"parser": "@typescript-eslint/parser",
3+
"parserOptions": {
4+
"warnOnUnsupportedTypeScriptVersion": false,
5+
"ecmaVersion": 6,
6+
"sourceType": "module",
7+
"project": "./src/tsconfig-base.json"
8+
},
9+
"env": {
10+
"browser": false,
11+
"node": true,
12+
"es6": true
13+
},
14+
"plugins": [
15+
"@typescript-eslint", "microsoft-typescript"
16+
],
17+
"rules": {
18+
"@typescript-eslint/adjacent-overload-signatures": "off",
19+
"@typescript-eslint/array-type": "off",
20+
"@typescript-eslint/ban-types": "off",
21+
"camelcase": "off",
22+
"@typescript-eslint/camelcase": "off",
23+
"@typescript-eslint/class-name-casing": "off",
24+
"@typescript-eslint/explicit-member-accessibility": "off",
25+
"@typescript-eslint/import/order": "off",
26+
"indent": "off",
27+
"@typescript-eslint/indent": "off",
28+
"@typescript-eslint/interface-name-prefix": "off",
29+
"@typescript-eslint/member-ordering": "off",
30+
"@typescript-eslint/no-angle-bracket-type-assertion": "off",
31+
"@typescript-eslint/no-empty-interface": "off",
32+
"@typescript-eslint/no-explicit-any": "off",
33+
"@typescript-eslint/no-inferrable-types": "off",
34+
"@typescript-eslint/no-misused-new": "error",
35+
"@typescript-eslint/no-namespace": "off",
36+
"@typescript-eslint/no-object-literal-type-assertion": "off",
37+
"@typescript-eslint/no-parameter-properties": "off",
38+
"@typescript-eslint/no-this-alias": "off",
39+
"@typescript-eslint/no-triple-slash-reference": "off",
40+
"@typescript-eslint/no-unnecessary-qualifier": "off",
41+
"@typescript-eslint/no-unnecessary-type-assertion": "off",
42+
"@typescript-eslint/no-use-before-define": "off",
43+
"@typescript-eslint/no-var-requires": "off",
44+
"@typescript-eslint/prefer-for-of": "error",
45+
"@typescript-eslint/prefer-function-type": "off",
46+
"@typescript-eslint/prefer-interface": "off",
47+
"@typescript-eslint/prefer-namespace-keyword": "off",
48+
"semi": "off",
49+
"@typescript-eslint/semi": "off",
50+
"@typescript-eslint/type-annotation-spacing": "off",
51+
"@typescript-eslint/unified-signatures": "off",
52+
53+
"microsoft-typescript/object-literal-surrounding-space": "off",
54+
"microsoft-typescript/no-type-assertion-whitespace": "error",
55+
"microsoft-typescript/type-operator-spacing": "off",
56+
"microsoft-typescript/only-arrow-functions": "off",
57+
"microsoft-typescript/no-double-space": "off",
58+
"microsoft-typescript/boolean-trivia": "off",
59+
"microsoft-typescript/no-in-operator": "off",
60+
"microsoft-typescript/debug-assert": "off",
61+
"microsoft-typescript/no-keywords": "off",
62+
63+
"arrow-body-style": "off",
64+
"arrow-parens": "off",
65+
"brace-style": "off",
66+
"comma-dangle": "off",
67+
"complexity": "off",
68+
"constructor-super": "error",
69+
"curly": ["error", "multi-line"],
70+
"dot-notation": "off",
71+
"eol-last": "off",
72+
"eqeqeq": "error",
73+
"guard-for-in": "off",
74+
"linebreak-style": "off",
75+
"max-classes-per-file": "off",
76+
"max-len": "off",
77+
"new-parens": "error",
78+
"no-bitwise": "off",
79+
"no-caller": "error",
80+
"no-cond-assign": "off",
81+
"no-console": "off",
82+
"no-debugger": "off",
83+
"no-duplicate-case": "error",
84+
"no-duplicate-imports": "error",
85+
"no-empty": "off",
86+
"no-eval": "off",
87+
"no-extra-bind": "error",
88+
"no-fallthrough": "off",
89+
"no-invalid-this": "off",
90+
"no-multiple-empty-lines": "off",
91+
"no-new-func": "off",
92+
"no-new-wrappers": "error",
93+
"no-redeclare": "off",
94+
"no-return-await": "error",
95+
"no-restricted-globals": "off",
96+
"no-sequences": "off",
97+
"no-shadow": "off",
98+
"no-sparse-arrays": "error",
99+
"no-template-curly-in-string": "off",
100+
"no-throw-literal": "off",
101+
"no-trailing-spaces": "off",
102+
"no-undef-init": "error",
103+
"no-unsafe-finally": "error",
104+
"no-unused-expressions": "off",
105+
"no-unused-labels": "error",
106+
"no-var": "off",
107+
"object-shorthand": "off",
108+
"one-var": "off",
109+
"prefer-const": "off",
110+
"prefer-object-spread": "error",
111+
"quote-props": ["error", "consistent-as-needed"],
112+
"quotes": "off",
113+
"radix": "off",
114+
"sort-keys": "off",
115+
"space-before-function-paren": "off",
116+
"space-in-parens": "off",
117+
"unicode-bom": ["error", "never"],
118+
"use-isnan": "error",
119+
"valid-typeof": "off"
120+
}
121+
}

Gulpfile.js

+15-26
Original file line numberDiff line numberDiff line change
@@ -318,34 +318,23 @@ task("clean-tests").description = "Cleans the outputs for the test infrastructur
318318

319319
const watchTests = () => watchProject("src/testRunner", cmdLineOptions);
320320

321-
const buildRules = () => buildProject("scripts/tslint");
322-
task("build-rules", buildRules);
323-
task("build-rules").description = "Compiles tslint rules to js";
324-
325-
const cleanRules = () => cleanProject("scripts/tslint");
326-
cleanTasks.push(cleanRules);
327-
task("clean-rules", cleanRules);
328-
task("clean-rules").description = "Cleans the outputs for the lint rules";
329-
330321
const lintFoldStart = async () => { if (fold.isTravis()) console.log(fold.start("lint")); };
331322
const lintFoldEnd = async () => { if (fold.isTravis()) console.log(fold.end("lint")); };
332-
const lint = series([
333-
lintFoldStart,
334-
...["scripts/tslint/tsconfig.json", "src/tsconfig-base.json"].map(project => {
335-
const lintOne = () => {
336-
const args = ["node_modules/tslint/bin/tslint", "--project", project, "--formatters-dir", "./built/local/tslint/formatters", "--format", "autolinkableStylish"];
337-
if (cmdLineOptions.fix) args.push("--fix");
338-
log(`Linting: node ${args.join(" ")}`);
339-
return exec(process.execPath, args);
340-
};
341-
lintOne.dispayName = `lint(${project})`;
342-
return lintOne;
343-
}),
344-
lintFoldEnd
345-
]);
323+
const eslint = async () => {
324+
const args = [
325+
"node_modules/eslint/bin/eslint", "-f", "autolinkable-stylish", "-c", ".eslintrc", "--ext", ".ts", "."
326+
];
327+
328+
if (cmdLineOptions.fix) {
329+
args.push("--fix");
330+
}
331+
log(`Linting: ${args.join(" ")}`);
332+
return exec(process.execPath, args);
333+
}
334+
const lint = series([lintFoldStart, eslint, lintFoldEnd]);
346335
lint.displayName = "lint";
347-
task("lint", series(buildRules, lint));
348-
task("lint").description = "Runs tslint on the compiler sources.";
336+
task("lint", lint);
337+
task("lint").description = "Runs eslint on the compiler sources.";
349338
task("lint").flags = {
350339
" --f[iles]=<regex>": "pattern to match files to lint",
351340
};
@@ -393,7 +382,7 @@ const generateCodeCoverage = () => exec("istanbul", ["cover", "node_modules/moch
393382
task("generate-code-coverage", series(preBuild, buildTests, generateCodeCoverage));
394383
task("generate-code-coverage").description = "Generates code coverage data via istanbul";
395384

396-
const preTest = parallel(buildRules, buildTests, buildServices, buildLssl);
385+
const preTest = parallel(buildTests, buildServices, buildLssl);
397386
preTest.displayName = "preTest";
398387

399388
const postTest = (done) => cmdLineOptions.lint ? lint(done) : done();

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ gulp runtests # Run tests using the built compiler and test infrastructu
8282
# You can override the host or specify a test for this command.
8383
# Use --host=<hostName> or --tests=<testPath>.
8484
gulp baseline-accept # This replaces the baseline test results with the results obtained from gulp runtests.
85-
gulp lint # Runs tslint on the TypeScript source.
85+
gulp lint # Runs eslint on the TypeScript source.
8686
gulp help # List the above commands.
8787
```
8888

package.json

+7-1
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,22 @@
5454
"@types/through2": "latest",
5555
"@types/travis-fold": "latest",
5656
"@types/xml2js": "^0.4.0",
57+
"@typescript-eslint/eslint-plugin": "latest",
58+
"@typescript-eslint/parser": "latest",
59+
"async": "latest",
5760
"azure-devops-node-api": "^8.0.0",
5861
"browser-resolve": "^1.11.2",
5962
"browserify": "latest",
6063
"chai": "latest",
6164
"chalk": "latest",
6265
"convert-source-map": "latest",
6366
"del": "latest",
67+
"eslint": "latest",
68+
"eslint-formatter-autolinkable-stylish": "latest",
69+
"eslint-plugin-microsoft-typescript": "0.1.11",
6470
"fancy-log": "latest",
6571
"fs-extra": "^6.0.1",
72+
"glob": "latest",
6673
"gulp": "^4.0.0",
6774
"gulp-concat": "latest",
6875
"gulp-insert": "latest",
@@ -85,7 +92,6 @@
8592
"source-map-support": "latest",
8693
"through2": "latest",
8794
"travis-fold": "latest",
88-
"tslint": "latest",
8995
"typescript": "next",
9096
"vinyl": "latest",
9197
"vinyl-sourcemaps-apply": "latest",

scripts/tslint/formatters/autolinkableStylishFormatter.ts

-97
This file was deleted.

0 commit comments

Comments
 (0)