From a96c5159eecce95f3dc5f19b2183caddeed4cec5 Mon Sep 17 00:00:00 2001 From: Mert Akinc <7282195+m-akinc@users.noreply.github.com> Date: Fri, 1 Mar 2024 18:31:06 -0600 Subject: [PATCH] Fixes --- .github/workflows/main.yml | 2 +- angular-workspace/.eslintrc.js | 5 +- .../projects/ni/spright-angular/.eslintrc.js | 71 ++++++++++++++++++- package-lock.json | 9 +++ packages/spright-components/package.json | 9 +++ 5 files changed, 92 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 3638cbafc83..bdc88acfa8b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -113,7 +113,7 @@ jobs: workingDir: ./packages/spright-components externals: | - '.storybook/public/**' - storybookBuildDir: ../../packages/site/dist/storybook + storybookBuildDir: ../../packages/site/dist/storybook-spright exitOnceUploaded: true # Do not wait for test results exitZeroOnChanges: true # Option to prevent the workflow from failing diff --git a/angular-workspace/.eslintrc.js b/angular-workspace/.eslintrc.js index e56f9b35585..54fb9f39458 100644 --- a/angular-workspace/.eslintrc.js +++ b/angular-workspace/.eslintrc.js @@ -14,7 +14,7 @@ module.exports = { message: 'Do not directly use underlying libraries of nimble. Instead rely on or add to exports of nimble packages.' }, { - group: ['@ni/nimble-components/**/tests', '@ni/nimble-components/**/testing'], + group: ['@ni/nimble-components/**/tests', '@ni/nimble-components/**/testing', '@ni/spright-components/**/tests', '@ni/spright-components/**/testing'], message: 'Do not use test code/utilities in production code.' }] }], @@ -45,6 +45,9 @@ module.exports = { }, { group: ['@ni/nimble-components'], message: 'Nimble Angular tests should not have to directly depend on nimble-components.' + }, { + group: ['@ni/spright-components'], + message: 'Spright Angular tests should not have to directly depend on spright-components.' }] } ] diff --git a/angular-workspace/projects/ni/spright-angular/.eslintrc.js b/angular-workspace/projects/ni/spright-angular/.eslintrc.js index 33b1659088c..eb60faf359e 100644 --- a/angular-workspace/projects/ni/spright-angular/.eslintrc.js +++ b/angular-workspace/projects/ni/spright-angular/.eslintrc.js @@ -1,14 +1,81 @@ +const path = require('path'); + module.exports = { extends: '../../../.eslintrc.js', + ignorePatterns: [ + '!**/*', + '**/dist' + ], + plugins: ['jsdoc'], overrides: [ { - files: ['*.ts'], + files: [ + '*.ts' + ], parserOptions: { project: [ './tsconfig.lib.json', './tsconfig.spec.json' ], - tsconfigRootDir: __dirname + tsconfigRootDir: __dirname, + createDefaultProgram: true + }, + rules: { + // Require non-empty JSDoc comment on classes + 'jsdoc/require-jsdoc': [ + 'error', + { + publicOnly: false, + require: { + ClassDeclaration: true, + FunctionDeclaration: false + } + } + ], + 'jsdoc/require-description': [ + 'error', + { contexts: ['ClassDeclaration'] } + ], + } + }, + { + files: [ + '*.js', + '*.ts' + ], + rules: { + // Use package.json from angular-workspace root + 'import/no-extraneous-dependencies': ['error', { packageDir: path.resolve(__dirname, '../../../') }], + // 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) or tests (not public API) + files: [ + '*.module.ts', '*.spec.ts' + ], + rules: { + 'jsdoc/require-jsdoc': 'off', + 'jsdoc/require-description': 'off' + } + }, + { + files: [ + '*.html' + ], + rules: {} + }, + { + files: [ + 'build/**/*.js' + ], + rules: { + // Logging in build scripts is useful + 'no-console': 'off', + // Rollup config files use default exports + 'import/no-default-export': 'off' } } ] diff --git a/package-lock.json b/package-lock.json index 47c240825d6..fd1bd9f8121 100644 --- a/package-lock.json +++ b/package-lock.json @@ -34452,6 +34452,12 @@ "@babel/core": "^7.20.12", "@ni/eslint-config-javascript": "^4.2.0", "@ni/eslint-config-typescript": "^4.2.0", + "@ni/jasmine-parameterized": "^0.2.2", + "@rollup/plugin-commonjs": "^24.0.1", + "@rollup/plugin-json": "^6.0.0", + "@rollup/plugin-node-resolve": "^15.0.1", + "@rollup/plugin-replace": "^5.0.1", + "@rollup/plugin-terser": "^0.4.0", "@storybook/addon-a11y": "^7.4.0", "@storybook/addon-actions": "^7.4.0", "@storybook/addon-docs": "^7.0.4", @@ -34490,6 +34496,9 @@ "prettier-eslint": "^15.0.1", "prettier-eslint-cli": "^7.1.0", "remark-gfm": "^3.0.1", + "rollup": "^3.10.1", + "rollup-plugin-polyfill-node": "^0.12.0", + "rollup-plugin-sourcemaps": "^0.6.3", "source-map-loader": "^4.0.0", "storybook": "^7.4.0", "ts-loader": "^9.2.5", diff --git a/packages/spright-components/package.json b/packages/spright-components/package.json index cf5daff780b..e214290d61d 100644 --- a/packages/spright-components/package.json +++ b/packages/spright-components/package.json @@ -66,6 +66,12 @@ "@babel/core": "^7.20.12", "@ni/eslint-config-javascript": "^4.2.0", "@ni/eslint-config-typescript": "^4.2.0", + "@ni/jasmine-parameterized": "^0.2.2", + "@rollup/plugin-commonjs": "^24.0.1", + "@rollup/plugin-json": "^6.0.0", + "@rollup/plugin-node-resolve": "^15.0.1", + "@rollup/plugin-replace": "^5.0.1", + "@rollup/plugin-terser": "^0.4.0", "@storybook/addon-a11y": "^7.4.0", "@storybook/addon-actions": "^7.4.0", "@storybook/addon-docs": "^7.0.4", @@ -104,6 +110,9 @@ "prettier-eslint": "^15.0.1", "prettier-eslint-cli": "^7.1.0", "remark-gfm": "^3.0.1", + "rollup": "^3.10.1", + "rollup-plugin-polyfill-node": "^0.12.0", + "rollup-plugin-sourcemaps": "^0.6.3", "source-map-loader": "^4.0.0", "storybook": "^7.4.0", "ts-loader": "^9.2.5",