diff --git a/.github/workflows/verify-pr/identify-affected-workspaces.mjs b/.github/workflows/verify-pr/identify-affected-workspaces.mjs index 528c571c..272a1d4f 100644 --- a/.github/workflows/verify-pr/identify-affected-workspaces.mjs +++ b/.github/workflows/verify-pr/identify-affected-workspaces.mjs @@ -19,6 +19,7 @@ function main() { displayList('THE FOLLOWING FILES WERE CHANGED:', changedFiles); const changedPackages = identifyChangedPackages(changedFiles); + if (changedPackages.length === 0) { console.log(`No package-level changes. Using empty workspace arg to test all packages.`); fs.writeFileSync(tmpFilePath, ''); @@ -34,7 +35,17 @@ function main() { console.log(`NO PACKAGES HAVE DEPENDENCIES ON CHANGED PACKAGES.\n`); } - const affectedPackages = [...(new Set([...changedPackages, ...dependentPackages]).keys())]; + const undeletedChangedPackages = changedPackages.filter(pkgLocation => { + const packageName = pkgLocation.replace("packages","").replace("/","").replace("\\",""); + if(fs.existsSync(getPackageJsonFile(packageName))) { + return true; + } else { + console.log(`Removing package '${packageName}' from list of workspaces since it seems to have been deleted.`); + } + }); + + + const affectedPackages = [...(new Set([...undeletedChangedPackages, ...dependentPackages]).keys())]; displayList('BASED ON THE ABOVE, THE FOLLOWING PACKAGES ARE AFFECTED BY CHANGES, AND WILL REQUIRE TESTING:', affectedPackages); const correspondingWorkspaceArgs = affectedPackages.map(name => `--workspace ${name}`); @@ -100,8 +111,12 @@ function getAllPackageJsons() { return packagesDir.filter(f => fs.statSync(path.join(pathToRoot, 'packages', f)).isDirectory()).map(getPackageJson); } +function getPackageJsonFile(packageName) { + return path.join(pathToRoot, 'packages', packageName, 'package.json'); +} + function getPackageJson(packageName) { - const packageJsonPath = path.join(pathToRoot, 'packages', packageName, 'package.json'); + const packageJsonPath = getPackageJsonFile(packageName); return JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8')); } diff --git a/.node-scripts/validate-changed-package-versions.js b/.node-scripts/validate-changed-package-versions.js index 831e6d8e..6c22398f 100644 --- a/.node-scripts/validate-changed-package-versions.js +++ b/.node-scripts/validate-changed-package-versions.js @@ -75,8 +75,15 @@ function isFileInTestFolder(changedFile) { function identifyIncorrectlyVersionedPackages(changedPackages) { const incorrectlyVersionedPackages = []; + for (const changedPackage of changedPackages) { - const packageVersion = getPackageVersion(changedPackage); + + const packageJsonPath = path.join(changedPackage, 'package.json'); + if (!fs.existsSync(packageJsonPath)) { + continue; // This means the package was deleted, so we ignore this package + } + const packageVersion = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8')).version; + if (!packageVersion.endsWith('-SNAPSHOT')) { incorrectlyVersionedPackages.push(`${changedPackage} (currently versioned as ${packageVersion}) lacks a trailing "-SNAPSHOT"`); continue; @@ -102,9 +109,4 @@ function getLatestReleasedVersion(changedPackage) { } } -function getPackageVersion(changedPackage) { - const packageJsonPath = path.join(changedPackage, 'package.json'); - return JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8')).version; -} - main(); diff --git a/package-lock.json b/package-lock.json index 75a25763..ce95839c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1751,10 +1751,6 @@ "resolved": "packages/code-analyzer-sfge-engine", "link": true }, - "node_modules/@salesforce/code-analyzer-stylelint-engine": { - "resolved": "packages/code-analyzer-stylelint-engine", - "link": true - }, "node_modules/@salesforce/engine-template": { "resolved": "packages/ENGINE-TEMPLATE", "link": true @@ -1768,10 +1764,6 @@ "eslint": "^7 || ^8" } }, - "node_modules/@salesforce/t-e-m-p-l-a-t-e": { - "resolved": "packages/T-E-M-P-L-A-T-E", - "link": true - }, "node_modules/@sinclair/typebox": { "version": "0.34.38", "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.34.38.tgz", @@ -11520,258 +11512,6 @@ "node": "*" } }, - "packages/code-analyzer-stylelint-engine": { - "name": "@salesforce/code-analyzer-stylelint-engine", - "version": "0.1.0-SNAPSHOT", - "license": "BSD-3-Clause", - "dependencies": { - "@salesforce/code-analyzer-engine-api": "0.28.0", - "@types/node": "^20.0.0" - }, - "devDependencies": { - "@eslint/js": "^9.32.0", - "@types/jest": "^30.0.0", - "eslint": "^9.32.0", - "jest": "^30.0.5", - "rimraf": "^6.0.1", - "ts-jest": "^29.4.1", - "typescript": "^5.9.2", - "typescript-eslint": "^8.37.0" - }, - "engines": { - "node": ">=20.0.0" - } - }, - "packages/code-analyzer-stylelint-engine/node_modules/@eslint/eslintrc": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-3.3.1.tgz", - "integrity": "sha512-gtF186CXhIl1p4pJNGZw8Yc6RlshoePRvE0X91oPGb3vZ8pM3qOS9W9NGPat9LziaBV7XrJWGylNQXkGcnM3IQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "ajv": "^6.12.4", - "debug": "^4.3.2", - "espree": "^10.0.1", - "globals": "^14.0.0", - "ignore": "^5.2.0", - "import-fresh": "^3.2.1", - "js-yaml": "^4.1.0", - "minimatch": "^3.1.2", - "strip-json-comments": "^3.1.1" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, - "packages/code-analyzer-stylelint-engine/node_modules/@eslint/js": { - "version": "9.32.0", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.32.0.tgz", - "integrity": "sha512-BBpRFZK3eX6uMLKz8WxFOBIFFcGFJ/g8XuwjTHCqHROSIsopI+ddn/d5Cfh36+7+e5edVS8dbSHnBNhrLEX0zg==", - "dev": true, - "license": "MIT", - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "url": "https://eslint.org/donate" - } - }, - "packages/code-analyzer-stylelint-engine/node_modules/brace-expansion": { - "version": "1.1.12", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz", - "integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==", - "dev": true, - "license": "MIT", - "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "packages/code-analyzer-stylelint-engine/node_modules/eslint": { - "version": "9.32.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.32.0.tgz", - "integrity": "sha512-LSehfdpgMeWcTZkWZVIJl+tkZ2nuSkyyB9C27MZqFWXuph7DvaowgcTvKqxvpLW1JZIk8PN7hFY3Rj9LQ7m7lg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@eslint-community/eslint-utils": "^4.2.0", - "@eslint-community/regexpp": "^4.12.1", - "@eslint/config-array": "^0.21.0", - "@eslint/config-helpers": "^0.3.0", - "@eslint/core": "^0.15.0", - "@eslint/eslintrc": "^3.3.1", - "@eslint/js": "9.32.0", - "@eslint/plugin-kit": "^0.3.4", - "@humanfs/node": "^0.16.6", - "@humanwhocodes/module-importer": "^1.0.1", - "@humanwhocodes/retry": "^0.4.2", - "@types/estree": "^1.0.6", - "@types/json-schema": "^7.0.15", - "ajv": "^6.12.4", - "chalk": "^4.0.0", - "cross-spawn": "^7.0.6", - "debug": "^4.3.2", - "escape-string-regexp": "^4.0.0", - "eslint-scope": "^8.4.0", - "eslint-visitor-keys": "^4.2.1", - "espree": "^10.4.0", - "esquery": "^1.5.0", - "esutils": "^2.0.2", - "fast-deep-equal": "^3.1.3", - "file-entry-cache": "^8.0.0", - "find-up": "^5.0.0", - "glob-parent": "^6.0.2", - "ignore": "^5.2.0", - "imurmurhash": "^0.1.4", - "is-glob": "^4.0.0", - "json-stable-stringify-without-jsonify": "^1.0.1", - "lodash.merge": "^4.6.2", - "minimatch": "^3.1.2", - "natural-compare": "^1.4.0", - "optionator": "^0.9.3" - }, - "bin": { - "eslint": "bin/eslint.js" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "url": "https://eslint.org/donate" - }, - "peerDependencies": { - "jiti": "*" - }, - "peerDependenciesMeta": { - "jiti": { - "optional": true - } - } - }, - "packages/code-analyzer-stylelint-engine/node_modules/eslint-scope": { - "version": "8.4.0", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-8.4.0.tgz", - "integrity": "sha512-sNXOfKCn74rt8RICKMvJS7XKV/Xk9kA7DyJr8mJik3S7Cwgy3qlkkmyS2uQB3jiJg6VNdZd/pDBJu0nvG2NlTg==", - "dev": true, - "license": "BSD-2-Clause", - "dependencies": { - "esrecurse": "^4.3.0", - "estraverse": "^5.2.0" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, - "packages/code-analyzer-stylelint-engine/node_modules/eslint-visitor-keys": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.2.1.tgz", - "integrity": "sha512-Uhdk5sfqcee/9H/rCOJikYz67o0a2Tw2hGRPOG2Y1R2dg7brRe1uG0yaNQDHu+TO/uQPF/5eCapvYSmHUjt7JQ==", - "dev": true, - "license": "Apache-2.0", - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, - "packages/code-analyzer-stylelint-engine/node_modules/espree": { - "version": "10.4.0", - "resolved": "https://registry.npmjs.org/espree/-/espree-10.4.0.tgz", - "integrity": "sha512-j6PAQ2uUr79PZhBjP5C5fhl8e39FmRnOjsD5lGnWrFU8i2G776tBK7+nP8KuQUTTyAZUwfQqXAgrVH5MbH9CYQ==", - "dev": true, - "license": "BSD-2-Clause", - "dependencies": { - "acorn": "^8.15.0", - "acorn-jsx": "^5.3.2", - "eslint-visitor-keys": "^4.2.1" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, - "packages/code-analyzer-stylelint-engine/node_modules/estraverse": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", - "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", - "dev": true, - "license": "BSD-2-Clause", - "engines": { - "node": ">=4.0" - } - }, - "packages/code-analyzer-stylelint-engine/node_modules/file-entry-cache": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-8.0.0.tgz", - "integrity": "sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "flat-cache": "^4.0.0" - }, - "engines": { - "node": ">=16.0.0" - } - }, - "packages/code-analyzer-stylelint-engine/node_modules/flat-cache": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-4.0.1.tgz", - "integrity": "sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw==", - "dev": true, - "license": "MIT", - "dependencies": { - "flatted": "^3.2.9", - "keyv": "^4.5.4" - }, - "engines": { - "node": ">=16" - } - }, - "packages/code-analyzer-stylelint-engine/node_modules/globals": { - "version": "14.0.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-14.0.0.tgz", - "integrity": "sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "packages/code-analyzer-stylelint-engine/node_modules/ignore": { - "version": "5.3.2", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz", - "integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 4" - } - }, - "packages/code-analyzer-stylelint-engine/node_modules/minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dev": true, - "license": "ISC", - "dependencies": { - "brace-expansion": "^1.1.7" - }, - "engines": { - "node": "*" - } - }, "packages/ENGINE-TEMPLATE": { "name": "@salesforce/engine-template", "version": "0.1.0-SNAPSHOT", @@ -12023,258 +11763,6 @@ "engines": { "node": "*" } - }, - "packages/T-E-M-P-L-A-T-E": { - "name": "@salesforce/t-e-m-p-l-a-t-e", - "version": "0.1.0-SNAPSHOT", - "license": "BSD-3-Clause", - "dependencies": { - "@salesforce/code-analyzer-engine-api": "0.28.0", - "@types/node": "^20.0.0" - }, - "devDependencies": { - "@eslint/js": "^9.32.0", - "@types/jest": "^30.0.0", - "eslint": "^9.32.0", - "jest": "^30.0.5", - "rimraf": "^6.0.1", - "ts-jest": "^29.4.1", - "typescript": "^5.9.2", - "typescript-eslint": "^8.37.0" - }, - "engines": { - "node": ">=20.0.0" - } - }, - "packages/T-E-M-P-L-A-T-E/node_modules/@eslint/eslintrc": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-3.3.1.tgz", - "integrity": "sha512-gtF186CXhIl1p4pJNGZw8Yc6RlshoePRvE0X91oPGb3vZ8pM3qOS9W9NGPat9LziaBV7XrJWGylNQXkGcnM3IQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "ajv": "^6.12.4", - "debug": "^4.3.2", - "espree": "^10.0.1", - "globals": "^14.0.0", - "ignore": "^5.2.0", - "import-fresh": "^3.2.1", - "js-yaml": "^4.1.0", - "minimatch": "^3.1.2", - "strip-json-comments": "^3.1.1" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, - "packages/T-E-M-P-L-A-T-E/node_modules/@eslint/js": { - "version": "9.32.0", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.32.0.tgz", - "integrity": "sha512-BBpRFZK3eX6uMLKz8WxFOBIFFcGFJ/g8XuwjTHCqHROSIsopI+ddn/d5Cfh36+7+e5edVS8dbSHnBNhrLEX0zg==", - "dev": true, - "license": "MIT", - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "url": "https://eslint.org/donate" - } - }, - "packages/T-E-M-P-L-A-T-E/node_modules/brace-expansion": { - "version": "1.1.12", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz", - "integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==", - "dev": true, - "license": "MIT", - "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "packages/T-E-M-P-L-A-T-E/node_modules/eslint": { - "version": "9.32.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.32.0.tgz", - "integrity": "sha512-LSehfdpgMeWcTZkWZVIJl+tkZ2nuSkyyB9C27MZqFWXuph7DvaowgcTvKqxvpLW1JZIk8PN7hFY3Rj9LQ7m7lg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@eslint-community/eslint-utils": "^4.2.0", - "@eslint-community/regexpp": "^4.12.1", - "@eslint/config-array": "^0.21.0", - "@eslint/config-helpers": "^0.3.0", - "@eslint/core": "^0.15.0", - "@eslint/eslintrc": "^3.3.1", - "@eslint/js": "9.32.0", - "@eslint/plugin-kit": "^0.3.4", - "@humanfs/node": "^0.16.6", - "@humanwhocodes/module-importer": "^1.0.1", - "@humanwhocodes/retry": "^0.4.2", - "@types/estree": "^1.0.6", - "@types/json-schema": "^7.0.15", - "ajv": "^6.12.4", - "chalk": "^4.0.0", - "cross-spawn": "^7.0.6", - "debug": "^4.3.2", - "escape-string-regexp": "^4.0.0", - "eslint-scope": "^8.4.0", - "eslint-visitor-keys": "^4.2.1", - "espree": "^10.4.0", - "esquery": "^1.5.0", - "esutils": "^2.0.2", - "fast-deep-equal": "^3.1.3", - "file-entry-cache": "^8.0.0", - "find-up": "^5.0.0", - "glob-parent": "^6.0.2", - "ignore": "^5.2.0", - "imurmurhash": "^0.1.4", - "is-glob": "^4.0.0", - "json-stable-stringify-without-jsonify": "^1.0.1", - "lodash.merge": "^4.6.2", - "minimatch": "^3.1.2", - "natural-compare": "^1.4.0", - "optionator": "^0.9.3" - }, - "bin": { - "eslint": "bin/eslint.js" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "url": "https://eslint.org/donate" - }, - "peerDependencies": { - "jiti": "*" - }, - "peerDependenciesMeta": { - "jiti": { - "optional": true - } - } - }, - "packages/T-E-M-P-L-A-T-E/node_modules/eslint-scope": { - "version": "8.4.0", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-8.4.0.tgz", - "integrity": "sha512-sNXOfKCn74rt8RICKMvJS7XKV/Xk9kA7DyJr8mJik3S7Cwgy3qlkkmyS2uQB3jiJg6VNdZd/pDBJu0nvG2NlTg==", - "dev": true, - "license": "BSD-2-Clause", - "dependencies": { - "esrecurse": "^4.3.0", - "estraverse": "^5.2.0" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, - "packages/T-E-M-P-L-A-T-E/node_modules/eslint-visitor-keys": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.2.1.tgz", - "integrity": "sha512-Uhdk5sfqcee/9H/rCOJikYz67o0a2Tw2hGRPOG2Y1R2dg7brRe1uG0yaNQDHu+TO/uQPF/5eCapvYSmHUjt7JQ==", - "dev": true, - "license": "Apache-2.0", - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, - "packages/T-E-M-P-L-A-T-E/node_modules/espree": { - "version": "10.4.0", - "resolved": "https://registry.npmjs.org/espree/-/espree-10.4.0.tgz", - "integrity": "sha512-j6PAQ2uUr79PZhBjP5C5fhl8e39FmRnOjsD5lGnWrFU8i2G776tBK7+nP8KuQUTTyAZUwfQqXAgrVH5MbH9CYQ==", - "dev": true, - "license": "BSD-2-Clause", - "dependencies": { - "acorn": "^8.15.0", - "acorn-jsx": "^5.3.2", - "eslint-visitor-keys": "^4.2.1" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, - "packages/T-E-M-P-L-A-T-E/node_modules/estraverse": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", - "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", - "dev": true, - "license": "BSD-2-Clause", - "engines": { - "node": ">=4.0" - } - }, - "packages/T-E-M-P-L-A-T-E/node_modules/file-entry-cache": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-8.0.0.tgz", - "integrity": "sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "flat-cache": "^4.0.0" - }, - "engines": { - "node": ">=16.0.0" - } - }, - "packages/T-E-M-P-L-A-T-E/node_modules/flat-cache": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-4.0.1.tgz", - "integrity": "sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw==", - "dev": true, - "license": "MIT", - "dependencies": { - "flatted": "^3.2.9", - "keyv": "^4.5.4" - }, - "engines": { - "node": ">=16" - } - }, - "packages/T-E-M-P-L-A-T-E/node_modules/globals": { - "version": "14.0.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-14.0.0.tgz", - "integrity": "sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "packages/T-E-M-P-L-A-T-E/node_modules/ignore": { - "version": "5.3.2", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz", - "integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 4" - } - }, - "packages/T-E-M-P-L-A-T-E/node_modules/minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dev": true, - "license": "ISC", - "dependencies": { - "brace-expansion": "^1.1.7" - }, - "engines": { - "node": "*" - } } } } diff --git a/packages/T-E-M-P-L-A-T-E/LICENSE b/packages/T-E-M-P-L-A-T-E/LICENSE deleted file mode 100644 index feee407a..00000000 --- a/packages/T-E-M-P-L-A-T-E/LICENSE +++ /dev/null @@ -1,14 +0,0 @@ -BSD 3-Clause License - -Copyright (c) 2024, Salesforce.com, Inc. -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - -* Neither the name of Salesforce.com nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/packages/T-E-M-P-L-A-T-E/README.md b/packages/T-E-M-P-L-A-T-E/README.md deleted file mode 100644 index 5d6b4eab..00000000 --- a/packages/T-E-M-P-L-A-T-E/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# Overview - -Use this template to create any generic packages for publishing. For an engine-specific template, refer to [ENGINE-TEMPLATE](../ENGINE-TEMPLATE/README.md). diff --git a/packages/T-E-M-P-L-A-T-E/eslint.config.mjs b/packages/T-E-M-P-L-A-T-E/eslint.config.mjs deleted file mode 100644 index 44661709..00000000 --- a/packages/T-E-M-P-L-A-T-E/eslint.config.mjs +++ /dev/null @@ -1,16 +0,0 @@ -import eslint from '@eslint/js'; -import tseslint from 'typescript-eslint'; - -export default tseslint.config( - eslint.configs.recommended, - ...tseslint.configs.recommended, - { - rules: { - "@typescript-eslint/no-unused-vars": ["error", { - "argsIgnorePattern": "^_", - "varsIgnorePattern": "^_", - "caughtErrorsIgnorePattern": "^_" - }] - } - } -); diff --git a/packages/T-E-M-P-L-A-T-E/package.json b/packages/T-E-M-P-L-A-T-E/package.json deleted file mode 100644 index 46db5ddd..00000000 --- a/packages/T-E-M-P-L-A-T-E/package.json +++ /dev/null @@ -1,63 +0,0 @@ -{ - "name": "@salesforce/t-e-m-p-l-a-t-e", - "description": "T-E-M-P-L-A-T-E", - "version": "0.1.0-SNAPSHOT", - "author": "The Salesforce Code Analyzer Team", - "license": "BSD-3-Clause", - "homepage": "https://developer.salesforce.com/docs/platform/salesforce-code-analyzer/overview", - "repository": { - "type": "git", - "url": "git+https://github.com/forcedotcom/code-analyzer-core.git", - "directory": "packages/T-E-M-P-L-A-T-E" - }, - "main": "dist/index.js", - "types": "dist/index.d.ts", - "dependencies": { - "@types/node": "^20.0.0", - "@salesforce/code-analyzer-engine-api": "0.28.0" - }, - "devDependencies": { - "@eslint/js": "^9.32.0", - "@types/jest": "^30.0.0", - "eslint": "^9.32.0", - "jest": "^30.0.5", - "rimraf": "^6.0.1", - "ts-jest": "^29.4.1", - "typescript": "^5.9.2", - "typescript-eslint": "^8.37.0" - }, - "engines": { - "node": ">=20.0.0" - }, - "files": [ - "dist", - "LICENSE", - "package.json" - ], - "scripts": { - "build": "tsc --build tsconfig.build.json --verbose", - "test": "jest --coverage", - "lint": "eslint src/**/*.ts", - "package": "npm pack", - "all": "npm run build && npm run lint && npm run test && npm run package", - "clean": "tsc --build tsconfig.build.json --clean", - "postclean": "rimraf dist && rimraf coverage && rimraf ./*.tgz && rimraf vulnerabilities", - "scrub": "npm run clean && rimraf node_modules", - "showcoverage": "open ./coverage/lcov-report/index.html" - }, - "jest": { - "preset": "ts-jest", - "testEnvironment": "node", - "testMatch": [ - "**/*.test.ts" - ], - "testPathIgnorePatterns": [ - "/node_modules/", - "/dist/" - ], - "collectCoverageFrom": [ - "src/**/*.ts", - "!src/index.ts" - ] - } -} \ No newline at end of file diff --git a/packages/T-E-M-P-L-A-T-E/src/index.ts b/packages/T-E-M-P-L-A-T-E/src/index.ts deleted file mode 100644 index c1db403c..00000000 --- a/packages/T-E-M-P-L-A-T-E/src/index.ts +++ /dev/null @@ -1 +0,0 @@ -// This file should only contain the main exports for the package \ No newline at end of file diff --git a/packages/T-E-M-P-L-A-T-E/src/messages.ts b/packages/T-E-M-P-L-A-T-E/src/messages.ts deleted file mode 100644 index 4c15789e..00000000 --- a/packages/T-E-M-P-L-A-T-E/src/messages.ts +++ /dev/null @@ -1,18 +0,0 @@ -import {getMessageFromCatalog} from "@salesforce/code-analyzer-engine-api"; - -const MESSAGE_CATALOG : { [key: string]: string } = { - TemplateMessage1: - `This message has one variable, '%s', in its message.`, - - TemplateMessage2: - `This message has two variables, '%s' and %d, in its message.` -} - -/** - * getMessage - This is the convenience function to get a message out of the message catalog. - * @param msgId - The message identifier - * @param args - The arguments that will fill in the %s and %d markers. - */ -export function getMessage(msgId: string, ...args: (string | number)[]): string { - return getMessageFromCatalog(MESSAGE_CATALOG, msgId, ...args); -} \ No newline at end of file diff --git a/packages/T-E-M-P-L-A-T-E/test/temp.test.ts b/packages/T-E-M-P-L-A-T-E/test/temp.test.ts deleted file mode 100644 index d8202e63..00000000 --- a/packages/T-E-M-P-L-A-T-E/test/temp.test.ts +++ /dev/null @@ -1,12 +0,0 @@ -import {changeWorkingDirectoryToPackageRoot} from "./test-helpers"; -import {getMessage} from "../src/messages"; - -changeWorkingDirectoryToPackageRoot(); - -describe('Temporary test', () => { - it('Temporary test', () => { - // This is just a temporary assertion to get code coverage - expect(getMessage('TemplateMessage2', 'hello', 3)).toEqual( - `This message has two variables, 'hello' and 3, in its message.`); - }); -}); diff --git a/packages/T-E-M-P-L-A-T-E/test/test-helpers.ts b/packages/T-E-M-P-L-A-T-E/test/test-helpers.ts deleted file mode 100644 index 4d98690e..00000000 --- a/packages/T-E-M-P-L-A-T-E/test/test-helpers.ts +++ /dev/null @@ -1,18 +0,0 @@ -import process from "node:process"; -import path from "node:path"; - -export function changeWorkingDirectoryToPackageRoot() { - let original_working_directory: string; - beforeAll(() => { - // We change the directory to ensure that the config files (which use relative folders from the package root) - // are processed correctly. The project root directory is typically the one used by default, but it may be - // different if the tests are run from the mono-repo's root directory. Lastly, it is better to use the - // package root directory is instead of the test directory since some IDEs (like IntelliJ) fail to collect - // code coverage correctly unless this package root directory is used. - original_working_directory = process.cwd(); - process.chdir(path.resolve(__dirname,'..')); - }); - afterAll(() => { - process.chdir(original_working_directory); - }); -} diff --git a/packages/T-E-M-P-L-A-T-E/tsconfig.build.json b/packages/T-E-M-P-L-A-T-E/tsconfig.build.json deleted file mode 100644 index 69d7a287..00000000 --- a/packages/T-E-M-P-L-A-T-E/tsconfig.build.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "extends": "../../tsconfig.base.json", - "compilerOptions": { - "composite": true, - "outDir": "./dist", - "rootDir": "./src" - }, - "include": [ - "./src" - ], - "references": [ - { - "path": "../code-analyzer-engine-api/tsconfig.build.json" - } - ] -} diff --git a/packages/T-E-M-P-L-A-T-E/tsconfig.json b/packages/T-E-M-P-L-A-T-E/tsconfig.json deleted file mode 100644 index 8f5b9142..00000000 --- a/packages/T-E-M-P-L-A-T-E/tsconfig.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "extends": "./tsconfig.build.json", - "compilerOptions": { - "composite": true, - "outDir": "./dist", - "rootDir": ".", - "isolatedModules": true - }, - "include": [ - "./src", - "./test" - ] - } diff --git a/packages/code-analyzer-stylelint-engine/LICENSE b/packages/code-analyzer-stylelint-engine/LICENSE deleted file mode 100644 index 39d18bf7..00000000 --- a/packages/code-analyzer-stylelint-engine/LICENSE +++ /dev/null @@ -1,14 +0,0 @@ -BSD 3-Clause License - -Copyright (c) 2025, Salesforce.com, Inc. -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - -* Neither the name of Salesforce.com nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/packages/code-analyzer-stylelint-engine/eslint.config.mjs b/packages/code-analyzer-stylelint-engine/eslint.config.mjs deleted file mode 100644 index 44661709..00000000 --- a/packages/code-analyzer-stylelint-engine/eslint.config.mjs +++ /dev/null @@ -1,16 +0,0 @@ -import eslint from '@eslint/js'; -import tseslint from 'typescript-eslint'; - -export default tseslint.config( - eslint.configs.recommended, - ...tseslint.configs.recommended, - { - rules: { - "@typescript-eslint/no-unused-vars": ["error", { - "argsIgnorePattern": "^_", - "varsIgnorePattern": "^_", - "caughtErrorsIgnorePattern": "^_" - }] - } - } -); diff --git a/packages/code-analyzer-stylelint-engine/package.json b/packages/code-analyzer-stylelint-engine/package.json deleted file mode 100644 index 17fec790..00000000 --- a/packages/code-analyzer-stylelint-engine/package.json +++ /dev/null @@ -1,63 +0,0 @@ -{ - "name": "@salesforce/code-analyzer-stylelint-engine", - "description": "Plugin package that adds 'stylelint' as an engine into Salesforce Code Analyzer", - "version": "0.1.0-SNAPSHOT", - "author": "The Salesforce Code Analyzer Team", - "license": "BSD-3-Clause", - "homepage": "https://developer.salesforce.com/docs/platform/salesforce-code-analyzer/overview", - "repository": { - "type": "git", - "url": "git+https://github.com/forcedotcom/code-analyzer-core.git", - "directory": "packages/code-analyzer-stylelint-engine" - }, - "main": "dist/index.js", - "types": "dist/index.d.ts", - "dependencies": { - "@types/node": "^20.0.0", - "@salesforce/code-analyzer-engine-api": "0.28.0" - }, - "devDependencies": { - "@eslint/js": "^9.32.0", - "@types/jest": "^30.0.0", - "eslint": "^9.32.0", - "jest": "^30.0.5", - "rimraf": "^6.0.1", - "ts-jest": "^29.4.1", - "typescript": "^5.9.2", - "typescript-eslint": "^8.37.0" - }, - "engines": { - "node": ">=20.0.0" - }, - "files": [ - "dist", - "LICENSE", - "package.json" - ], - "scripts": { - "build": "tsc --build tsconfig.build.json --verbose", - "test": "jest --coverage", - "lint": "eslint src/**/*.ts", - "package": "npm pack", - "all": "npm run build && npm run lint && npm run test && npm run package", - "clean": "tsc --build tsconfig.build.json --clean", - "postclean": "rimraf dist && rimraf coverage && rimraf ./*.tgz && rimraf vulnerabilities", - "scrub": "npm run clean && rimraf node_modules", - "showcoverage": "open ./coverage/lcov-report/index.html" - }, - "jest": { - "preset": "ts-jest", - "testEnvironment": "node", - "testMatch": [ - "**/*.test.ts" - ], - "testPathIgnorePatterns": [ - "/node_modules/", - "/dist/" - ], - "collectCoverageFrom": [ - "src/**/*.ts", - "!src/index.ts" - ] - } -} \ No newline at end of file diff --git a/packages/code-analyzer-stylelint-engine/src/engine.ts b/packages/code-analyzer-stylelint-engine/src/engine.ts deleted file mode 100644 index 5b64fe8d..00000000 --- a/packages/code-analyzer-stylelint-engine/src/engine.ts +++ /dev/null @@ -1,76 +0,0 @@ -import { DescribeOptions, Engine, EngineRunResults, LogLevel, RuleDescription, RunOptions, Violation } from "@salesforce/code-analyzer-engine-api"; -import * as fsp from 'node:fs/promises'; -import path from "path"; -import { getMessage } from "./messages"; - -export class StylelintEngine extends Engine { - static readonly NAME = "stylelint"; - - // *** Consider passing in a configuration object from your engine's plugin if you want to provide user-configuration - constructor() { - super(); - } - - getName(): string { - return StylelintEngine.NAME; - } - - public async getEngineVersion(): Promise { - const pathToPackageJson: string = path.join(__dirname, '..', 'package.json'); - const packageJson: {version: string} = JSON.parse(await fsp.readFile(pathToPackageJson, 'utf-8')); - return packageJson.version; - } - - // *** Remove underscore for private naming convention if you need any of the DescribeOptions - async describeRules(_describeOptions: DescribeOptions): Promise { - // *** Best Practice - Use RunRulesProgressEvents to keep users informed on the scan progress - this.emitRunRulesProgressEvent(0); - - // *** Parse out relevant file types if you engine is language-specific - //const relevantFiles: string[] | undefined; - - // *** Get your rules! - const ruleDescriptions: RuleDescription[] = []; - - this.emitRunRulesProgressEvent(50); - - // *** Retrieval Implementation is up to you, but you'll need to map them into RuleDescription form, such as: - const exampleRule: RuleDescription = { - name: "ExampleStylelintRule", - severityLevel: 5, - tags: [ - "Recommended" - ], - description: "The description of your rule", - resourceUrls: [] - }; - ruleDescriptions.push(exampleRule); - - // *** Best Practice - Set RunRulesProgressEvents to 100 before completing - this.emitDescribeRulesProgressEvent(100); - return ruleDescriptions; - } - - // *** ruleNames comes from a describeRules call made just before running - async runRules(_ruleNames: string[], _runOptions: RunOptions): Promise { - - // *** Best Practice - Use RunRulesProgressEvents to keep users informed on the scan progress - this.emitRunRulesProgressEvent(2); - - // *** Get your violations! - const violations: Violation[] = []; - - // *** Rule Implementation - map any violations to Violations and CodeLocations - // *** If Violations do not have CodeLocations they will be shown in modal form - - // *** Best Practice - Use messages sparingly to keep users informed - // *** Ideal for failures, or an announcement - const one = '1' - this.emitLogEvent(LogLevel.Debug, getMessage('TemplateMessage2', one, '2')); - - this.emitRunRulesProgressEvent(100); - return { - violations: violations - }; - } -} \ No newline at end of file diff --git a/packages/code-analyzer-stylelint-engine/src/index.ts b/packages/code-analyzer-stylelint-engine/src/index.ts deleted file mode 100644 index 2cbd2ab9..00000000 --- a/packages/code-analyzer-stylelint-engine/src/index.ts +++ /dev/null @@ -1,10 +0,0 @@ -// This file should only contain the main exports for the package - -import { StylelintEnginePlugin } from "./plugin"; -import { EnginePlugin } from "@salesforce/code-analyzer-engine-api"; - -function createEnginePlugin(): EnginePlugin { - return new StylelintEnginePlugin(); -} - -export { createEnginePlugin, StylelintEnginePlugin } \ No newline at end of file diff --git a/packages/code-analyzer-stylelint-engine/src/messages.ts b/packages/code-analyzer-stylelint-engine/src/messages.ts deleted file mode 100644 index 276d504c..00000000 --- a/packages/code-analyzer-stylelint-engine/src/messages.ts +++ /dev/null @@ -1,21 +0,0 @@ -import {getMessageFromCatalog} from "@salesforce/code-analyzer-engine-api"; - -const MESSAGE_CATALOG : { [key: string]: string } = { - TemplateMessage1: - `This message has one variable, '%s', in its message.`, - - TemplateMessage2: - `This message has two variables, '%s' and %d, in its message.`, - - UnsupportedEngineName: - `The StylelintEnginePlugin does not support an engine with name '%s'.` -} - -/** - * getMessage - This is the convenience function to get a message out of the message catalog. - * @param msgId - The message identifier - * @param args - The arguments that will fill in the %s and %d markers. - */ -export function getMessage(msgId: string, ...args: (string | number)[]): string { - return getMessageFromCatalog(MESSAGE_CATALOG, msgId, ...args); -} \ No newline at end of file diff --git a/packages/code-analyzer-stylelint-engine/src/plugin.ts b/packages/code-analyzer-stylelint-engine/src/plugin.ts deleted file mode 100644 index 64640c48..00000000 --- a/packages/code-analyzer-stylelint-engine/src/plugin.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { - ConfigObject, - Engine, - EnginePluginV1, -} from "@salesforce/code-analyzer-engine-api"; -import {getMessage} from "./messages"; -import { StylelintEngine } from "./engine"; - -export class StylelintEnginePlugin extends EnginePluginV1 { - - // *** If your plugin provides multiple engines, we accept that here - getAvailableEngineNames(): string[] { - return [StylelintEngine.NAME]; - } - - async createEngine(engineName: string, _resolvedConfig: ConfigObject): Promise { - validateEngineName(engineName); - // *** Update to use _resolvedConfig, if user-configuration is desired - return new StylelintEngine(); - } - - // *** Methods available for use if user-configuration is desired - //describeEngineConfig(engineName: string): ConfigDescription; - //createEngineConfig(engineName: string, configValueExtractor: ConfigValueExtractor): Promise; - -} - -// *** Best Practice - validate the engine name in every public method -// since this library is public -function validateEngineName(engineName: string) { - if (engineName !== StylelintEngine.NAME) { - throw new Error(getMessage('UnsupportedEngineName', engineName)); - } -} \ No newline at end of file diff --git a/packages/code-analyzer-stylelint-engine/test/engine.test.ts b/packages/code-analyzer-stylelint-engine/test/engine.test.ts deleted file mode 100644 index caa68b33..00000000 --- a/packages/code-analyzer-stylelint-engine/test/engine.test.ts +++ /dev/null @@ -1,71 +0,0 @@ -import { EngineRunResults, RuleDescription, RunOptions, Workspace } from "@salesforce/code-analyzer-engine-api"; -import fs from "node:fs"; -import * as os from "node:os"; -import path from "path"; -import { StylelintEngine } from "../src/engine"; -import { changeWorkingDirectoryToPackageRoot } from "./test-helpers"; - -changeWorkingDirectoryToPackageRoot(); - -const TEST_DATA_FOLDER: string = path.join(__dirname, 'test-data'); - -describe('Stylelint Engine Tests', () => { - - let ALL_EXPECTED_RULES: RuleDescription[]; - - beforeAll(async() => { - ALL_EXPECTED_RULES = await getExpectedRulesFromGoldFile('temp-goldfile.json'); - }); - - describe('getName', () => { - it('When getName is called, then stylelint name is returned', () => { - const engine: StylelintEngine = new StylelintEngine(); - expect(engine.getName()).toEqual('stylelint'); - }); - }); - - describe('getVersion', () => { - // *** Update to your new engine - it('Outputs something resembling a semantic version', async () => { - const engine: StylelintEngine = new StylelintEngine(); - const version: string = await engine.getEngineVersion(); - - expect(version).toMatch(/\d+\.\d+\.\d+.*/); - }); - }); - - describe('describeRules', () => { - // *** Update to your new engine; - // add more checks for specific rules, describe options, and logging events - it('When no workspace is provided, then all rules are returned', async () => { - const engine: StylelintEngine = new StylelintEngine(); - const rules: RuleDescription[] = await engine.describeRules({logFolder: os.tmpdir()}); - - expect(rules).toEqual(ALL_EXPECTED_RULES); - }); - }); - - describe('runRules', () => { - // *** Add more checks for specific rules, describe options, and logging events - it('When zero rule names are provided then return zero violations', async () => { - const engine: StylelintEngine = new StylelintEngine(); - const results: EngineRunResults = await engine.runRules([], createRunOptions(new Workspace('id', [TEST_DATA_FOLDER]))); - expect(results.violations).toHaveLength(0); - }); - - // *** Update to your new engine; - // Test violations - }); - - async function getExpectedRulesFromGoldFile(relativeExpectedFile: string): Promise { - const expectedRulesJsonStr: string = (await fs.promises.readFile(path.join(TEST_DATA_FOLDER, relativeExpectedFile), 'utf-8')); - return JSON.parse(expectedRulesJsonStr) as RuleDescription[]; - } - - function createRunOptions(workspace: Workspace): RunOptions { - return { - logFolder: os.tmpdir(), - workspace: workspace - } - } -}); diff --git a/packages/code-analyzer-stylelint-engine/test/plugin.test.ts b/packages/code-analyzer-stylelint-engine/test/plugin.test.ts deleted file mode 100644 index cb41376d..00000000 --- a/packages/code-analyzer-stylelint-engine/test/plugin.test.ts +++ /dev/null @@ -1,34 +0,0 @@ -// *** Use the ConfigValueExtractor if user-configuration needs testing -//import { ConfigValueExtractor } from "@salesforce/code-analyzer-engine-api"; -import { EnginePluginV1 } from "@salesforce/code-analyzer-engine-api"; -import { StylelintEngine } from "../src/engine"; -import { getMessage } from "../src/messages"; -import { StylelintEnginePlugin } from "../src/plugin"; - -describe('Tests for the StylelintEnginePlugin', () => { - let plugin: EnginePluginV1; - // *** Update to your new name - const engineName = 'stylelint' - beforeAll(() => { - plugin = new StylelintEnginePlugin(); - }); - - describe('getAvailableEngineNames', () => { - it(`When the getAvailableEngineNames method is called then 'stylelint' is returned`, () => { - expect(plugin.getAvailableEngineNames()).toEqual([engineName]); - }); - }); - - describe('createEngine', () => { - it(`When the create engine is called with a invalid name then an error is thrown`, async() => { - await expect(plugin.createEngine('error_engine', {})).rejects.toThrow( - getMessage('UnsupportedEngineName', 'error_engine')); - }); - - it(`When createEngine is passed 'stylelint', then the StylelintEngine is returned`, async() => { - expect(await plugin.createEngine(engineName, {})).toBeInstanceOf(StylelintEngine); - }); - - }); - -}); \ No newline at end of file diff --git a/packages/code-analyzer-stylelint-engine/test/test-data/temp-goldfile.json b/packages/code-analyzer-stylelint-engine/test/test-data/temp-goldfile.json deleted file mode 100644 index fc7fa766..00000000 --- a/packages/code-analyzer-stylelint-engine/test/test-data/temp-goldfile.json +++ /dev/null @@ -1,11 +0,0 @@ -[ - { - "name": "ExampleStylelintRule", - "severityLevel": 5, - "tags": [ - "Recommended" - ], - "description": "The description of your rule", - "resourceUrls": [] - } -] \ No newline at end of file diff --git a/packages/code-analyzer-stylelint-engine/test/test-helpers.ts b/packages/code-analyzer-stylelint-engine/test/test-helpers.ts deleted file mode 100644 index 4d98690e..00000000 --- a/packages/code-analyzer-stylelint-engine/test/test-helpers.ts +++ /dev/null @@ -1,18 +0,0 @@ -import process from "node:process"; -import path from "node:path"; - -export function changeWorkingDirectoryToPackageRoot() { - let original_working_directory: string; - beforeAll(() => { - // We change the directory to ensure that the config files (which use relative folders from the package root) - // are processed correctly. The project root directory is typically the one used by default, but it may be - // different if the tests are run from the mono-repo's root directory. Lastly, it is better to use the - // package root directory is instead of the test directory since some IDEs (like IntelliJ) fail to collect - // code coverage correctly unless this package root directory is used. - original_working_directory = process.cwd(); - process.chdir(path.resolve(__dirname,'..')); - }); - afterAll(() => { - process.chdir(original_working_directory); - }); -} diff --git a/packages/code-analyzer-stylelint-engine/tsconfig.build.json b/packages/code-analyzer-stylelint-engine/tsconfig.build.json deleted file mode 100644 index 69d7a287..00000000 --- a/packages/code-analyzer-stylelint-engine/tsconfig.build.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "extends": "../../tsconfig.base.json", - "compilerOptions": { - "composite": true, - "outDir": "./dist", - "rootDir": "./src" - }, - "include": [ - "./src" - ], - "references": [ - { - "path": "../code-analyzer-engine-api/tsconfig.build.json" - } - ] -} diff --git a/packages/code-analyzer-stylelint-engine/tsconfig.json b/packages/code-analyzer-stylelint-engine/tsconfig.json deleted file mode 100644 index 8f5b9142..00000000 --- a/packages/code-analyzer-stylelint-engine/tsconfig.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "extends": "./tsconfig.build.json", - "compilerOptions": { - "composite": true, - "outDir": "./dist", - "rootDir": ".", - "isolatedModules": true - }, - "include": [ - "./src", - "./test" - ] - }