From 98bb24c2ed6273f13a1bbf04f4ac30004d990bda Mon Sep 17 00:00:00 2001 From: GZolla <43836485+GZolla@users.noreply.github.com> Date: Fri, 29 Nov 2024 10:32:18 -0800 Subject: [PATCH 1/2] Update templates to eslint9 --- .../default-content/templates/configured/_package.json | 6 +++--- .../default-content/templates/static/eslint.config.js | 8 ++++++++ src/generators/test-unit-axe/index.js | 4 ---- .../test-unit-axe/templates/static/test/.eslintrc.json | 3 --- src/generators/wc-lit-element/index.js | 1 - .../wc-lit-element/templates/static/.eslintrc.json | 3 --- 6 files changed, 11 insertions(+), 14 deletions(-) create mode 100644 src/generators/default-content/templates/static/eslint.config.js delete mode 100644 src/generators/test-unit-axe/templates/static/test/.eslintrc.json delete mode 100644 src/generators/wc-lit-element/templates/static/.eslintrc.json diff --git a/src/generators/default-content/templates/configured/_package.json b/src/generators/default-content/templates/configured/_package.json index f085c38..41e40f4 100644 --- a/src/generators/default-content/templates/configured/_package.json +++ b/src/generators/default-content/templates/configured/_package.json @@ -5,15 +5,15 @@ "repository": "https://github.com/<%= githubOrg %>/<%= hyphenatedName %>.git", "scripts": { "lint": "npm run lint:eslint && npm run lint:style", - "lint:eslint": "eslint . --ext .js,.html", + "lint:eslint": "eslint .", "lint:style": "stylelint \"**/*.{js,html}\"" }, "author": "D2L Corporation", "license": "Apache-2.0", "devDependencies": { "@brightspace-ui/stylelint-config": "^1", - "eslint": "^8", - "eslint-config-brightspace": "^1", + "eslint": "^9", + "eslint-config-brightspace": "^2", "stylelint": "^16" }, "files": [ diff --git a/src/generators/default-content/templates/static/eslint.config.js b/src/generators/default-content/templates/static/eslint.config.js new file mode 100644 index 0000000..ddc04d7 --- /dev/null +++ b/src/generators/default-content/templates/static/eslint.config.js @@ -0,0 +1,8 @@ +import { addExtensions, litConfig, setDirectoryConfigs, testingConfig } from 'eslint-config-brightspace'; + +export default setDirectoryConfigs( + addExtensions(litConfig, ['.js', '.html']), + { + test: testingConfig + } +); diff --git a/src/generators/test-unit-axe/index.js b/src/generators/test-unit-axe/index.js index ec62b40..abcf6bd 100644 --- a/src/generators/test-unit-axe/index.js +++ b/src/generators/test-unit-axe/index.js @@ -34,10 +34,6 @@ export function run(templateData) { ); } - copyFile( - `${__dirname}/templates/static/test/.eslintrc.json`, - `${getDestinationPath(templateData.hyphenatedName)}/test/.eslintrc.json` - ); replaceText(`${getDestinationPath(templateData.hyphenatedName)}/test/${templateData.hyphenatedName}.test.js`, templateData); replaceText(`${getDestinationPath(templateData.hyphenatedName)}/test/${templateData.hyphenatedName}.axe.js`, templateData); sortJSONMembers(`${getDestinationPath(templateData.hyphenatedName)}/package.json`, ['dependencies', 'devDependencies']); diff --git a/src/generators/test-unit-axe/templates/static/test/.eslintrc.json b/src/generators/test-unit-axe/templates/static/test/.eslintrc.json deleted file mode 100644 index 9c6a0b6..0000000 --- a/src/generators/test-unit-axe/templates/static/test/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "brightspace/testing-config" -} diff --git a/src/generators/wc-lit-element/index.js b/src/generators/wc-lit-element/index.js index 62f6c16..74b2d53 100644 --- a/src/generators/wc-lit-element/index.js +++ b/src/generators/wc-lit-element/index.js @@ -19,6 +19,5 @@ export function run(templateData) { ); replaceText(`${getDestinationPath(templateData.hyphenatedName)}/${templateData.hyphenatedName}.js`, templateDataElement); - copyFilesInDir(`${__dirname}/templates/static`, getDestinationPath(templateData.hyphenatedName)); sortJSONMembers(`${getDestinationPath(templateData.hyphenatedName)}/package.json`, ['dependencies', 'devDependencies']); } diff --git a/src/generators/wc-lit-element/templates/static/.eslintrc.json b/src/generators/wc-lit-element/templates/static/.eslintrc.json deleted file mode 100644 index d5cc9f3..0000000 --- a/src/generators/wc-lit-element/templates/static/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "brightspace/lit-config" -} From 97e6511a3654607367af031d5eaa487eb7256da6 Mon Sep 17 00:00:00 2001 From: GZolla <43836485+GZolla@users.noreply.github.com> Date: Fri, 29 Nov 2024 10:36:12 -0800 Subject: [PATCH 2/2] Appease Linter --- src/generators/wc-lit-element/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/generators/wc-lit-element/index.js b/src/generators/wc-lit-element/index.js index 74b2d53..023aa86 100644 --- a/src/generators/wc-lit-element/index.js +++ b/src/generators/wc-lit-element/index.js @@ -1,4 +1,4 @@ -import { copyFile, copyFilesInDir, getDestinationPath, mergeJSON, replaceText, sortJSONMembers } from '../../helper.js'; +import { copyFile, getDestinationPath, mergeJSON, replaceText, sortJSONMembers } from '../../helper.js'; export function run(templateData) { mergeJSON(