Skip to content
Closed
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
4,814 changes: 2,265 additions & 2,549 deletions package-lock.json

Large diffs are not rendered by default.

131 changes: 0 additions & 131 deletions packages/angular-workspace/.eslintrc.js

This file was deleted.

4 changes: 4 additions & 0 deletions packages/angular-workspace/angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"lint": {
"builder": "@angular-eslint/builder:lint",
"options": {
"eslintConfig": "nimble-angular/eslint.config.js",
"lintFilePatterns": [
"nimble-angular/**/*.ts",
"nimble-angular/**/*.js",
Expand Down Expand Up @@ -79,6 +80,7 @@
"lint": {
"builder": "@angular-eslint/builder:lint",
"options": {
"eslintConfig": "ok-angular/eslint.config.js",
"lintFilePatterns": [
"ok-angular/**/*.ts",
"ok-angular/**/*.js",
Expand Down Expand Up @@ -120,6 +122,7 @@
"lint": {
"builder": "@angular-eslint/builder:lint",
"options": {
"eslintConfig": "spright-angular/eslint.config.js",
"lintFilePatterns": [
"spright-angular/**/*.ts",
"spright-angular/**/*.js",
Expand Down Expand Up @@ -246,6 +249,7 @@
"lint": {
"builder": "@angular-eslint/builder:lint",
"options": {
"eslintConfig": "example-client-app/eslint.config.js",
"lintFilePatterns": [
"example-client-app/**/*.ts",
"example-client-app/**/*.js",
Expand Down
136 changes: 136 additions & 0 deletions packages/angular-workspace/configurations.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
import { javascriptNimbleConfig } from '@ni-private/eslint-config-nimble/javascript';
import { typescriptNimbleConfig } from '@ni-private/eslint-config-nimble/typescript';
import {
angularConfig,
angularTemplateConfig,
ignoreAttributes,
} from '@ni/eslint-config-angular';
import { defineConfig } from 'eslint/config';
import path from 'path';
import { fileURLToPath } from 'url';

const packageDir = path.dirname(fileURLToPath(import.meta.url));

export const configurations = defineConfig([
{
ignores: ['!**/*', '**/node_modules', '**/dist'],
},
{
files: ['**/*.js'],
extends: [...javascriptNimbleConfig],
rules: {
// Use package.json from angular-workspace root
'import/no-extraneous-dependencies': ['error', { packageDir }],
},
},
{
files: ['**/*.ts'],
extends: [...angularConfig, ...typescriptNimbleConfig],
rules: {
// Use package.json from angular-workspace root
'import/no-extraneous-dependencies': ['error', { packageDir }],
'no-restricted-imports': [
'error',
{
patterns: [
{
group: ['@ni/fast-*'],
message:
'Do not directly use underlying libraries of nimble. Instead rely on or add to exports of nimble packages.',
},
{
group: [
'@ni/*-components/**/tests',
'@ni/*-components/**/testing',
],
message: 'Do not use test code/utilities in production code.',
},
],
},
],

// Nimble Angular Components follow web component naming conventions
// where the attribute and property names are different formats
'@angular-eslint/no-input-rename': 'off',
},
},
{
// Don't require class docs on modules (they're trivial)
files: ['**/*.module.ts'],
rules: {
'jsdoc/require-jsdoc': 'off',
'jsdoc/require-description': 'off',
},
},
{
files: ['**/*.spec.ts'],
rules: {
'no-restricted-imports': [
'error',
{
patterns: [
{
group: ['@ni/fast-*'],
message:
'Do not directly use underlying libraries of nimble. Instead rely on or add to exports of nimble packages.',
},
{
group: ['@ni/nimble-components', '@ni/spright-components'],
message:
'Angular tests should not directly depend on web component packages.',
},
],
},
],

// Jasmine createSpyObj rely on accessing unbound methods
'@typescript-eslint/unbound-method': 'off',
},
},
{
files: ['**/testing/**'],
rules: {
'no-restricted-imports': [
'error',
{
patterns: [
{
group: ['@ni/fast-*'],
message:
'Do not directly use underlying libraries of nimble. Instead rely on or add to exports of nimble packages.',
},
],
},
],
},
},
{
files: ['**/*.html'],
extends: [...angularTemplateConfig],
rules: {
// Enable i18n template checking for the purpose of making sure to capture updates for the lint rules
'@angular-eslint/template/i18n': [
'error',
{
checkText: false,
checkId: false,
ignoreAttributes: [
// Attributes that SHOULD NOT ever be localized need to be added to ignoreAttributeSets
// See: https://github.com/ni/javascript-styleguide/blob/main/packages/eslint-config-angular/template/options.js
...ignoreAttributes.all,

// Attributes that SHOULD be localized in production, but we don't want to
// for tests / examples apps should be added to the following list:
'action-menu-label',
'aria-label',
'button-label',
'label',
'placeholder',
'text',
'title',
],
},
],
},
},
]);
6 changes: 6 additions & 0 deletions packages/angular-workspace/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import configurations from './configurations.js';
import { defineConfig } from 'eslint/config';

export default defineConfig([
configurations,
]);
35 changes: 0 additions & 35 deletions packages/angular-workspace/example-client-app/.eslintrc.js

This file was deleted.

48 changes: 48 additions & 0 deletions packages/angular-workspace/example-client-app/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import { fileURLToPath } from 'url';
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are too many changes in one shot. One thing to note is that packages do not need to migrate to "type": "module" in order to adopt eslint v9. Those can be decoupled, see the discussion here: ni/javascript-styleguide#170 (comment)

If the changes are minor outside the nimble repo then it may be fine but we should not switch the packages in nimble.

Copy link
Copy Markdown
Member

@rajsite rajsite Oct 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gokulprasanth-ni the nimble repo is sufficiently unusual that we'll handle the upgrade, but thanks for the initial draft

Copy link
Copy Markdown
Member

@rajsite rajsite Oct 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After sleeping on it, I think a plan to do the update in smaller parts would be:

  • One change that updates the eslint configs without changing the package types. Some configs use esm format and some use commonjs format. Also disable prettier temporarily by updating the lint and lint-concurrent scripts in package.json to not call prettier temporarily and only call eslint. Hopefully that minimizes the number of changes needed in the first PR.
  • A follow up PR where prettier is enabled and it's formatting changes are applied.

The goal being to not force nimble to switch to type module yet and to split prettier formatting changes to a separate standalone PR

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also incase it is a consideration, we should be updating the AzDo pipelines first

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah thanks for the suggestion Milan. I will plan to create PRs as suggested.

import path from 'path';
import { defineConfig } from 'eslint/config';
// eslint-disable-next-line import/extensions
import { configurations } from '../configurations.js';

const tsConfigRootDir = path.dirname(fileURLToPath(import.meta.url));

export default defineConfig([
configurations,
{
ignores: ['example-client-app/src/environments/**'],
},
{
files: ['example-client-app/**/*.ts'],
languageOptions: {
parserOptions: {
project: ['example-client-app/tsconfig.app.json', 'example-client-app/tsconfig.spec.json'],
tsConfigRootDir,
},
},
rules: {
'no-restricted-imports': [
'error',
{
patterns: [
{
group: ['@ni/fast-*'],
message:
'Do not directly use underlying libraries of nimble. Instead rely on or add to exports of nimble packages.',
},
{
group: ['@ni/*-components'],
message:
'Client Angular applications should not directly depend on web component packages.',
},
],
},
],
'@angular-eslint/component-selector': [
'error',
{ type: 'element', prefix: 'example', style: 'kebab-case' },
],
'jsdoc/require-jsdoc': 'off',
'jsdoc/require-description': 'off',
},
},
]);
Loading
Loading