Skip to content

Commit 0597936

Browse files
clydinvikerman
authored andcommitted
test: minor simplification of tslint script/configuration
1 parent fa4701f commit 0597936

2 files changed

Lines changed: 7 additions & 14 deletions

File tree

scripts/lint.ts

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,6 @@ import * as path from 'path';
1313
import { Configuration, ILinterOptions, Linter, findFormatter } from 'tslint';
1414
import * as ts from 'typescript';
1515

16-
// Excluded (regexes) of the files to not lint. Generated files should not be linted.
17-
// TODO: when moved to using bazel for the build system, this won't be needed.
18-
const excluded = [/^dist-schema[\\\/].*/, /.*\/third_party\/.*/];
19-
2016
function _buildRules(logger: logging.Logger) {
2117
const tsConfigPath = path.join(__dirname, '../etc/rules/tsconfig.json');
2218
const configFile = ts.readConfigFile(tsConfigPath, ts.sys.readFile);
@@ -52,11 +48,6 @@ export default async function(options: ParsedArgs, logger: logging.Logger) {
5248
const tsLintPath = path.join(__dirname, '../tslint.json');
5349
const tsLintConfig = Configuration.loadConfigurationFromPath(tsLintPath);
5450

55-
// Remove comments from the configuration, ie. keys that starts with "//".
56-
[...tsLintConfig.rules.keys()]
57-
.filter(x => x.startsWith('//'))
58-
.forEach(key => tsLintConfig.rules.delete(key));
59-
6051
// Console is used directly by tslint, and when finding a rule that doesn't exist it's considered
6152
// a warning by TSLint but _only_ shown on the console and impossible to see through the API.
6253
// In order to see any warnings that happen from TSLint itself, we hook into console.warn() and
@@ -69,11 +60,6 @@ export default async function(options: ParsedArgs, logger: logging.Logger) {
6960
};
7061

7162
program.getRootFileNames().forEach(fileName => {
72-
const filePath = path.relative(process.cwd(), fileName).replace(/\\/g, '/');
73-
if (excluded.some(x => x.test(filePath))) {
74-
return;
75-
}
76-
7763
linter.lint(fileName, ts.sys.readFile(fileName) || '', tsLintConfig);
7864
});
7965

tslint.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,13 @@
99
"dist/etc/rules",
1010
"node_modules/tslint-sonarts/lib/rules"
1111
],
12+
"linterOptions": {
13+
"format": "codeFrame",
14+
"exclude": [
15+
"dist-schema/**",
16+
"**/third_party/**"
17+
]
18+
},
1219
"rules": {
1320
// ==================================================================================================
1421
// custom rules defined in etc/rules/**

0 commit comments

Comments
 (0)