diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 3638cbafc8..bdc88acfa8 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 e56f9b3558..54fb9f3945 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 33b1659088..eb60faf359 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 47c240825d..fd1bd9f812 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 cf5daff780..e214290d61 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",