Skip to content
Open
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
3,443 changes: 1,901 additions & 1,542 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,6 @@
"beachball": "^2.41.0"
},
"peerDependencies": {
"typescript": "~4.8.2"
"typescript": "^5.0.0"
}
}
3 changes: 0 additions & 3 deletions packages/eslint-config-angular/.eslintrc.js

This file was deleted.

13 changes: 13 additions & 0 deletions packages/eslint-config-angular/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import javascript from '@ni/eslint-config-javascript';

export default [
...javascript,
{
files: ['**/*.js'],
rules: {
'import/no-default-export': 'off',
'import/no-extraneous-dependencies': 'off',
'import/no-unresolved': 'off',
},
},
];
271 changes: 133 additions & 138 deletions packages/eslint-config-angular/index.js
Original file line number Diff line number Diff line change
@@ -1,139 +1,134 @@
module.exports = {
extends: [
'plugin:@angular-eslint/recommended',
'plugin:@angular-eslint/template/process-inline-templates',
'@ni/eslint-config-typescript'
],
rules: {
/*
Overrides to Angular recommended rules:
https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin/src/configs/recommended.json
*/

'@angular-eslint/no-host-metadata-property': 'error',

/*
'@angular-eslint/no-input-rename' rule notes:
Disallow renaming directive inputs generally. Use an inline comment to disable the rule for exceptions where the
context changes significantly, or disable the rule for files of directives that need to prefix their inputs to avoid conflicts.
*/

/*
'@angular-eslint/no-output-rename' rule notes:
Disallow renaming directive outputs generally. Use an inline comment to disable the rule for exceptions where the
context changes significantly, or disable the rule for projects that use the dollar sign postfix for EventEmitters.
*/

/*
Upgrade the recommended rule configuration from a warning to an error.
*/
'@angular-eslint/use-lifecycle-interface': 'error',

// We intended to use the default from @typescript-eslint/recommended, but we adopted this override accidentally.
// See https://github.com/ni/javascript-styleguide/issues/139
'@typescript-eslint/no-inferrable-types': [
'error',
{ ignoreParameters: true }
],

/*
Overrides to Angular rules outside of the recommended configuration:
*/

/*
Extract templates and styles into a separate files. In rare cases, allow for inline templates of a few
elements with attributes and three minimal CSS declarations.
*/
'@angular-eslint/component-max-inline-declarations': ['error', { animations: 15, styles: 15, template: 15 }],

/* [application-prefix] */
'@angular-eslint/component-selector': 'off',

'@angular-eslint/contextual-decorator': 'error',

/*
Do not require a directive to select an element or attribute exclusively, because there are valid use cases
for both.
*/
'@angular-eslint/directive-selector': 'off',

'@angular-eslint/no-attribute-decorator': 'error',

/*
`forwardRef` is needed for certain Dependency Injection use cases and abuse is not widespread so its use is permitted.
*/
'@angular-eslint/no-forward-ref': 'off',

/*
We don't yet have a general naming conventions so enforcing a convention just for inputs would be inconsistent.
*/
'@angular-eslint/no-input-prefix': 'off',

'@angular-eslint/no-lifecycle-call': 'error',

'@angular-eslint/no-pipe-impure': 'error',

'@angular-eslint/no-queries-metadata-property': 'error',

/* [application-prefix] */
'@angular-eslint/pipe-prefix': 'error',

/*
This rule is for specific applications such as libraries that want to minimize global dependencies or parts
of an application that have specific performance goals.
*/
'@angular-eslint/prefer-on-push-component-change-detection': 'off',

/*
While marking @Output properties as readonly does better capture the intention of how they should generally be used,
it does not appear that there is wide-spread abuse of not marking @Output properties readonly. Marking them readonly
would deviate from the style given in most Angular docs and examples so this rule is not enabled.
*/
'@angular-eslint/prefer-output-readonly': 'off',

'@angular-eslint/relative-url-prefix': 'error',

'@angular-eslint/runtime-localize': 'error',

/*
Generally not expected in practice to sort NgModule metadata arrays. Projects may enable if desired.
*/
'@angular-eslint/sort-ngmodule-metadata-arrays': 'off',

'@angular-eslint/use-component-selector': 'error',

'@angular-eslint/use-component-view-encapsulation': 'error',

/*
Provide root services with the application root injector in the Injectable decorator. However, NgModule
providers are frequently preferred for non-root, module scoped services in applications where tree-shaking
is usually irrelevant. Additionally, libraries commonly export services from modules in order to manage
dependencies. Consider enabling this rule for libraries to ensure proper tree-shaking when appropriate.
*/
'@angular-eslint/use-injectable-provided-in': 'off'
},
overrides: [
{
files: ['*.spec.ts'],
rules: {
/*
Tests often define helper components and it improves test readability if they are in the same
file as the tests.
*/
'@angular-eslint/component-max-inline-declarations': 'off',

/*
Components defined in tests are typically only used within a single test file so don't need.
a compontent selector.
*/
'@angular-eslint/use-component-selector': 'off',

/*
Tests often define additional classes as mocks or helper components and it improves test readability
if those are in the same file as the tests.
*/
'max-classes-per-file': 'off'
}
import typescript from '@ni/eslint-config-typescript';
import angular from 'angular-eslint';

export default [
...angular.configs.tsRecommended,
...typescript,
{
processor: angular.processInlineTemplates,
rules: {

/*
'@angular-eslint/no-input-rename' rule notes:
Disallow renaming directive inputs generally. Use an inline comment to disable the rule for exceptions where the
context changes significantly, or disable the rule for files of directives that need to prefix their inputs to avoid conflicts.
*/

/*
'@angular-eslint/no-output-rename' rule notes:
Disallow renaming directive outputs generally. Use an inline comment to disable the rule for exceptions where the
context changes significantly, or disable the rule for projects that use the dollar sign postfix for EventEmitters.
*/

/*
Upgrade the recommended rule configuration from a warning to an error.
*/
'@angular-eslint/use-lifecycle-interface': 'error',

// We intended to use the default from @typescript-eslint/recommended, but we adopted this override accidentally.
// See https://github.com/ni/javascript-styleguide/issues/139
'@typescript-eslint/no-inferrable-types': [
'error',
{ ignoreParameters: true }
],

/*
Overrides to Angular rules outside of the recommended configuration:
*/

/*
Extract templates and styles into a separate files. In rare cases, allow for inline templates of a few
elements with attributes and three minimal CSS declarations.
*/
'@angular-eslint/component-max-inline-declarations': ['error', { animations: 15, styles: 15, template: 15 }],

/* [application-prefix] */
'@angular-eslint/component-selector': 'off',

'@angular-eslint/contextual-decorator': 'error',

/*
Do not require a directive to select an element or attribute exclusively, because there are valid use cases
for both.
*/
'@angular-eslint/directive-selector': 'off',

'@angular-eslint/no-attribute-decorator': 'error',

/*
`forwardRef` is needed for certain Dependency Injection use cases and abuse is not widespread so its use is permitted.
*/
'@angular-eslint/no-forward-ref': 'off',

/*
We don't yet have a general naming conventions so enforcing a convention just for inputs would be inconsistent.
*/
'@angular-eslint/no-input-prefix': 'off',

'@angular-eslint/no-lifecycle-call': 'error',

'@angular-eslint/no-pipe-impure': 'error',

'@angular-eslint/no-queries-metadata-property': 'error',

/* [application-prefix] */
'@angular-eslint/pipe-prefix': 'error',

/*
This rule is for specific applications such as libraries that want to minimize global dependencies or parts
of an application that have specific performance goals.
*/
'@angular-eslint/prefer-on-push-component-change-detection': 'off',

/*
While marking @Output properties as readonly does better capture the intention of how they should generally be used,
it does not appear that there is wide-spread abuse of not marking @Output properties readonly. Marking them readonly
would deviate from the style given in most Angular docs and examples so this rule is not enabled.
*/
'@angular-eslint/prefer-output-readonly': 'off',

'@angular-eslint/relative-url-prefix': 'error',

'@angular-eslint/runtime-localize': 'error',

/*
Generally not expected in practice to sort NgModule metadata arrays. Projects may enable if desired.
*/
'@angular-eslint/sort-ngmodule-metadata-arrays': 'off',

'@angular-eslint/use-component-selector': 'error',

'@angular-eslint/use-component-view-encapsulation': 'error',

/*
Provide root services with the application root injector in the Injectable decorator. However, NgModule
providers are frequently preferred for non-root, module scoped services in applications where tree-shaking
is usually irrelevant. Additionally, libraries commonly export services from modules in order to manage
dependencies. Consider enabling this rule for libraries to ensure proper tree-shaking when appropriate.
*/
'@angular-eslint/use-injectable-provided-in': 'off'
},
]
};
},
{
files: ['**/*.spec.ts'],
rules: {
/*
Tests often define helper components and it improves test readability if they are in the same
file as the tests.
*/
'@angular-eslint/component-max-inline-declarations': 'off',

/*
Components defined in tests are typically only used within a single test file so don't need.
a compontent selector.
*/
'@angular-eslint/use-component-selector': 'off',

/*
Tests often define additional classes as mocks or helper components and it improves test readability
if those are in the same file as the tests.
*/
'max-classes-per-file': 'off'
}
},
];
83 changes: 43 additions & 40 deletions packages/eslint-config-angular/package.json
Original file line number Diff line number Diff line change
@@ -1,42 +1,45 @@
{
"name": "@ni/eslint-config-angular",
"version": "9.0.6",
"description": "NI's Angular ESLint Shareable Config",
"main": "index.js",
"scripts": {
"lint": "eslint .",
"pack": "npm pack",
"print-available-rules": "node tools/print-available-rules"
},
"repository": {
"type": "git",
"url": "git+https://github.com/ni/javascript-styleguide.git"
},
"keywords": [
"eslint",
"eslintconfig",
"ni"
],
"author": "National Instruments",
"license": "MIT",
"bugs": {
"url": "https://github.com/ni/javascript-styleguide/issues"
},
"homepage": "https://github.com/ni/javascript-styleguide#readme",
"publishConfig": {
"access": "public"
},
"files": [
"**/*.js",
"!/.*.js",
"!/tools"
],
"peerDependencies": {
"@angular-eslint/builder": "^18.4.3",
"@angular-eslint/eslint-plugin": "^18.4.3",
"@angular-eslint/eslint-plugin-template": "^18.4.3",
"@angular-eslint/schematics": "^18.4.3",
"@angular-eslint/template-parser": "^18.4.3",
"@ni/eslint-config-typescript": "^4.4.3"
}
"type": "module",
"name": "@ni/eslint-config-angular",
"version": "9.0.6",
"description": "NI's Angular ESLint Shareable Config",
"main": "index.js",
"scripts": {
"lint": "eslint .",
"pack": "npm pack",
"print-available-rules": "node tools/print-available-rules"
},
"repository": {
"type": "git",
"url": "git+https://github.com/ni/javascript-styleguide.git"
},
"keywords": [
"eslint",
"eslintconfig",
"ni"
],
"author": "National Instruments",
"license": "MIT",
"bugs": {
"url": "https://github.com/ni/javascript-styleguide/issues"
},
"homepage": "https://github.com/ni/javascript-styleguide#readme",
"publishConfig": {
"access": "public"
},
"files": [
"**/*.js",
"!/.*.js",
"!/tools"
],
"peerDependencies": {
"angular-eslint": "^19.0.0",
"@ni/eslint-config-typescript": "file:../eslint-config-typescript"
},
"exports": {
".": "./index.js",
"./template": "./template.js",
"./requiring-type-checking": "./requiring-type-checking.js",
"./template/options": "./template/options.js"
}
}
Loading