2016-03-28 21:25:22 +00:00
{
2016-10-27 18:48:47 +00:00
"rulesDirectory" : [
2021-07-06 17:41:48 +00:00
"tools/tslint" ,
2022-07-27 08:03:49 +00:00
"node_modules/@angular/build-tooling/tslint-rules" ,
2016-12-08 21:46:08 +00:00
"node_modules/vrsource-tslint-rules/rules" ,
2019-05-02 15:44:24 +00:00
"node_modules/tslint-eslint-rules/dist/rules" ,
"node_modules/tslint-no-toplevel-property-access/rules"
2016-10-27 18:48:47 +00:00
] ,
"rules" : {
2021-07-06 17:41:48 +00:00
// The first rule needs to be `ts-node-loader` which sets up `ts-node` within TSLint so
// that rules written in TypeScript can be loaded without needing to be transpiled.
"ts-node-loader" : true ,
// Custom rules written in TypeScript.
"require-internal-with-underscore" : true ,
"no-implicit-override-abstract" : true ,
2022-07-27 08:03:49 +00:00
"validate-import-for-esm-cjs-interop" : [
true ,
{
// The following CommonJS modules have type definitions that suggest the existence of
// named exports. This is not true at runtime when imported from an ES module (because
// the ESM interop only exposes statically-discoverable named exports). Instead
// default imports should be used to ensure compatibility with both ESM or CommonJS.
"noNamedExports" : [
"typescript" ,
"minimist" ,
"magic-string" ,
"semver" ,
"yargs" ,
"glob" ,
"cluster" ,
"convert-source-map"
] ,
// The following CommonJS modules appear to have a default export available (due to the `esModuleInterop` flag),
// but at runtime with CJS (e.g. for devmode output/tests) there is no default export as these modules set
// `__esModule`. This does not match with what happens in ESM NodeJS runtime where NodeJS exposes
// `module.exports` as `export default`. Instead, named exports should be used for compat with CJS/ESM.
"noDefaultExport" : [ ] ,
// List of modules which are incompatible and should never be imported at all.
"incompatibleModules" : {
// `@babel/core` and `@babel/types` suggest named exports which do not exist at runtime within ESM
// (as these named exports are not statically discoverable by NodeJS). At the same time, these modules
// set `__esModule` and the default import does not exist for CJS at runtime (e.g. breaking tests).
"@babel/core" : "This module is incompatible with the ESM/CJS interop. Use the custom interop file." ,
"@babel/types" : "This module is incompatible with the ESM/CJS interop. Use the custom interop file and import the `types` namespace."
}
2021-09-25 12:58:32 +00:00
}
2022-07-27 08:03:49 +00:00
] ,
2021-06-04 14:57:07 +00:00
"eofline" : true ,
2018-08-16 22:55:45 +00:00
"file-header" : [
true ,
2020-05-19 19:07:26 +00:00
{
"match" : "Copyright Google LLC" ,
2021-12-10 02:37:01 +00:00
"allow-single-line-comments" : false ,
"default" : "@license\nCopyright Google LLC All Rights Reserved.\n\nUse of this source code is governed by an MIT-style license that can be\nfound in the LICENSE file at https://angular.io/license"
2020-05-19 19:07:26 +00:00
}
2018-08-16 22:55:45 +00:00
] ,
2022-07-27 08:03:49 +00:00
"no-console" : [ true , "log" ] ,
2019-10-16 23:52:48 +00:00
"no-construct" : true ,
2016-10-27 18:48:47 +00:00
"no-duplicate-imports" : true ,
"no-duplicate-variable" : true ,
2016-11-12 13:14:20 +00:00
"no-var-keyword" : true ,
2022-07-27 08:03:49 +00:00
"prefer-literal" : [ true , "object" ] ,
2019-05-02 15:44:24 +00:00
"no-toplevel-property-access" : [
true ,
"packages/animations/src/" ,
"packages/animations/browser/" ,
"packages/common/src/" ,
"packages/core/src/" ,
"packages/elements/src/" ,
"packages/forms/src/" ,
"packages/platform-browser/src/" ,
"packages/router/src/"
] ,
2022-07-27 08:03:49 +00:00
"semicolon" : [ true ] ,
"variable-name" : [ true , "ban-keywords" ] ,
"no-inner-declarations" : [ true , "function" ] ,
2021-05-29 11:25:53 +00:00
"no-debugger" : true ,
"ban" : [
true ,
{ "name" : "fdescribe" , "message" : "Don't keep jasmine focus methods." } ,
2022-08-17 15:06:41 +00:00
{ "name" : "fit" , "message" : "Don't keep jasmine focus methods." } ,
{ "name" : [ "*" , "getMutableClone" ] , "message" : "Use a ts.factory.update* or ts.factory.create* method instead." }
2021-05-29 11:25:53 +00:00
]
2017-09-22 17:51:03 +00:00
} ,
"jsRules" : {
2021-07-06 17:41:48 +00:00
// The first rule needs to be `ts-node-loader` which sets up `ts-node` within TSLint so
// that rules written in TypeScript can be loaded without needing to be transpiled.
"ts-node-loader" : true ,
// Custom rules written in TypeScript.
"require-internal-with-underscore" : true ,
2021-06-04 14:57:07 +00:00
"eofline" : true ,
2018-08-16 22:55:45 +00:00
"file-header" : [
true ,
2020-05-19 19:07:26 +00:00
{
"match" : "Copyright Google LLC" ,
2021-12-10 02:37:01 +00:00
"allow-single-line-comments" : false ,
"default" : "@license\nCopyright Google LLC All Rights Reserved.\n\nUse of this source code is governed by an MIT-style license that can be\nfound in the LICENSE file at https://angular.io/license"
2020-05-19 19:07:26 +00:00
}
2018-08-16 22:55:45 +00:00
] ,
2022-07-27 08:03:49 +00:00
"no-console" : [ true , "log" ] ,
2017-09-22 17:51:03 +00:00
"no-duplicate-imports" : true ,
"no-duplicate-variable" : true ,
2022-07-27 08:03:49 +00:00
"semicolon" : [ true ] ,
"variable-name" : [ true , "ban-keywords" ] ,
"no-inner-declarations" : [ true , "function" ] ,
2021-05-29 11:25:53 +00:00
"ban" : [
true ,
{ "name" : "fdescribe" , "message" : "Don't keep jasmine focus methods." } ,
{ "name" : "fit" , "message" : "Don't keep jasmine focus methods." }
2018-08-16 22:55:45 +00:00
]
2020-03-02 17:35:30 +00:00
} ,
"linterOptions" : {
"exclude" : [
"**/node_modules/**/*" ,
// Ignore AIO and integration tests.
"./aio/**/*" ,
"./integration/**/*" ,
// Ignore output directories
"./built/**/*" ,
"./dist/**/*" ,
"./bazel-out/**/*" ,
// Ignore special files
"**/*.externs.js" ,
// Ignore test files
2020-11-11 15:29:43 +00:00
"./packages/compiler-cli/test/compliance/test_cases/**/*" ,
2020-03-02 17:35:30 +00:00
"./packages/localize/**/test_files/**/*" ,
"./tools/public_api_guard/**/*.d.ts" ,
"./modules/benchmarks_external/**/*" ,
// Ignore zone.js directory
// TODO(JiaLiPassion): add zone.js back later
2021-12-09 05:44:17 +00:00
"./packages/zone.js/**/*" ,
2021-12-10 02:37:01 +00:00
"./devtools/bazel-out/**/*" ,
"./devtools/projects/ng-devtools/src/lib/vendor/**/*"
2020-03-02 17:35:30 +00:00
]
2016-10-27 18:48:47 +00:00
}
2019-05-02 15:44:24 +00:00
}