Openverse is a search engine for openly-licensed media. This monorepo includes all application code.
Move ESLint plugin inside `packages/js` (#4174)
Dhruv Bhanushalida3101db8944
diff --git a/.codespell/ignore_lines.txt b/.codespell/ignore_lines.txtindex 9563d9731..1366e9149 100644--- a/.codespell/ignore_lines.txt+++ b/.codespell/ignore_lines.txt@@ -17,6 +17,6 @@"Identificatie Titel(s): Allegorie op kunstenaar Francesco Mazzoli, ""bekend als Parmigianino"-;; packages/eslint-plugin/configs/vue.ts+;; packages/js/eslint-plugin/configs/vue.ts;; `te` gets matched with `the` and othersconst i18nDestructureRules = ["t", "tc", "te", "td", "d", "n"].map(diff --git a/.github/CODEOWNERS b/.github/CODEOWNERSindex 36f3dd0e5..ac9f27b13 100644--- a/.github/CODEOWNERS+++ b/.github/CODEOWNERS@@ -10,7 +10,7 @@ load_sample_data.sh @WordPress/openverse-apipyproject.toml @WordPress/openverse-apifrontend/ @WordPress/openverse-frontend-packages/ @WordPress/openverse-frontend+packages/js/ @WordPress/openverse-frontend.eslintignore @WordPress/openverse-frontend.eslintrc.js @WordPress/openverse-frontend.npmrc @WordPress/openverse-frontenddiff --git a/.github/filters.yml b/.github/filters.ymlindex a94b5b272..d5cda4e29 100644--- a/.github/filters.yml+++ b/.github/filters.yml@@ -23,15 +23,15 @@ ingestion_server:- load_sample_data.shfrontend:- frontend/**- - packages/**+ - packages/js/**- package.json- pnpm-lock.yaml- pnpm-workspace.yaml- tsconfig.base.json- .npmrc- .pnpmfile.cjs-packages:- - packages/**+js_packages:+ - packages/js/**- package.json- pnpm-lock.yaml- pnpm-workspace.yamldiff --git a/.github/renovate.json b/.github/renovate.jsonindex 4ead83bc7..8b9b0a165 100644--- a/.github/renovate.json+++ b/.github/renovate.json@@ -47,7 +47,7 @@"addLabels": ["🟨 tech: javascript"]},{- "matchFileNames": ["{frontend,packages}/**"],+ "matchFileNames": ["{frontend,packages/js}/**"],"addLabels": ["🧱 stack: frontend"]},{@@ -78,7 +78,7 @@},{"groupName": "@openverse/eslint-plugin",- "matchFileNames": ["packages/eslint-plugin/**"]+ "matchFileNames": ["packages/js/eslint-plugin/**"]},{"groupName": "tailwind",diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.ymlindex 743c244a2..7c1860d58 100644--- a/.github/workflows/ci_cd.yml+++ b/.github/workflows/ci_cd.yml@@ -44,7 +44,7 @@ jobs:frontend: ${{ contains(fromJson(steps.paths-filter.outputs.changes), 'frontend') }}documentation: ${{ contains(fromJson(steps.paths-filter.outputs.changes), 'documentation') }}ci_cd: ${{ contains(fromJson(steps.paths-filter.outputs.changes), 'ci_cd') }}- packages: ${{ contains(fromJson(steps.paths-filter.outputs.changes), 'packages') }}+ js_packages: ${{ contains(fromJson(steps.paths-filter.outputs.changes), 'js_packages') }}steps:- name: Checkout repositoryuses: actions/checkout@v4@@ -600,10 +600,10 @@ jobs:- name: Passrun: echo 'Playwright tests are skipped because frontend is unchanged.'- package-checks:- name: Run checks for packages/*+ js-package-checks:+ name: Run checks for JS packages/*if: |- needs.get-changes.outputs.packages == 'true'+ needs.get-changes.outputs.js_packages == 'true'runs-on: ubuntu-latestneeds:- get-changes@@ -630,19 +630,19 @@ jobs:setup_python: falseinstall_recipe: node-install- - name: Run packages checks- run: pnpm --filter ./packages/* run --aggregate-output ${{ matrix.script }}+ - name: Run JS packages checks+ run: pnpm --filter ./packages/js/* run --aggregate-output ${{ matrix.script }}- # This job runs when `package-checks` doesn't and always passes, thus allowing- # PRs to meet the required checks criteria and be merged.- bypass-package-checks:- name: Run checks for packages/*+ # This job runs when `js-package-checks` doesn't and always passes, thus+ # allowing PRs to meet the required checks criteria and be merged.+ bypass-js-package-checks:+ name: Run checks for JS packages/*if: |!cancelled() &&- needs.package-checks.result == 'skipped'+ needs.js-package-checks.result == 'skipped'runs-on: ubuntu-latestneeds:- - package-checks+ - js-package-checksstrategy:fail-fast: falsematrix:@@ -652,7 +652,7 @@ jobs:steps:- name: Pass- run: echo 'Checks for packages are skipped because packages are unchanged.'+ run: echo 'Checks for JS packages are skipped because they are unchanged.'playwright:name: Run Playwright testsdiff --git a/.pre-commit-config.yaml b/.pre-commit-config.yamlindex 1cb44402d..e125a8266 100644--- a/.pre-commit-config.yaml+++ b/.pre-commit-config.yaml@@ -118,14 +118,14 @@ repos:hooks:- id: typesname: types- files: ^(frontend|packages)/.*$+ files: ^(frontend|packages/js)/.*$entry: bash -c 'pnpm run -r types'language: systempass_filenames: false- id: eslintname: eslint- files: (frontend|automations|packages).*?\.(js|ts|vue|json5|json)$+ files: (frontend|automations|packages/js).*?\.(js|ts|vue|json5|json)$"types": [file] # ESLint only accepts [javascript] by default.language: systempass_filenames: false@@ -133,7 +133,7 @@ repos:- id: test:unitname: test:unit- files: ^(frontend|packages)/.*$+ files: ^(frontend|packages/js)/.*$entry: bash -c 'pnpm run -r test:unit'language: systempass_filenames: falsediff --git a/documentation/meta/ci_cd/jobs/packages.md b/documentation/meta/ci_cd/jobs/packages.mdindex 1540818e9..029a8bb6d 100644--- a/documentation/meta/ci_cd/jobs/packages.md+++ b/documentation/meta/ci_cd/jobs/packages.md@@ -1,8 +1,8 @@# Packages jobs-## `package-checks`+## `js-package-checks`-Runs a matrix for various checks of workspace packages in the `packages`+Runs a matrix for various checks of workspace packages in the `packages/js`directory using the following `package.json` scripts.| Name | Script |@@ -11,9 +11,9 @@ directory using the following `package.json` scripts.| `unit_test` | `test:unit` |```{note}-Not all packages in `packages` necessarily need to define both or any of these scripts.-`pnpm run -r` will safely ignore packages that do not define a given script and just-run it for the ones that do.+Not all packages in `packages/js/` necessarily need to define both or any of+these scripts. `pnpm run -r` will safely ignore packages that do not define a+given script and just run it for the ones that do.```Since this is a required check for a matrix job, it has a bypass counterpart.diff --git a/documentation/packages/index.md b/documentation/packages/index.mdindex 6c53f44c4..21fa5043e 100644--- a/documentation/packages/index.md+++ b/documentation/packages/index.md@@ -36,10 +36,10 @@ The easiest way to create a new package is to copy an existing one and modifythe details to match the needs. To create a new `@openverse/license-parsing`package, for example, we would do the following:-1. Copy `packages/eslint-plugin` to `packages/license-parsing`-2. Update `packages/license-parsing/package.json` to remove unneeded+1. Copy `packages/js/eslint-plugin` to `packages/js/license-parsing`+2. Update `packages/js/license-parsing/package.json` to remove unneededdependencies and update the package name-3. Delete the code in `packages/license-parsing/src`, update any relevant+3. Delete the code in `packages/js/license-parsing/src`, update any relevantconfiguration (`babel.config.js`, etc) and write the code for the new package🎉diff --git a/package.json b/package.jsonindex 2bdc36d1e..1342c14d0 100644--- a/package.json+++ b/package.json@@ -9,9 +9,9 @@},"author": "Openverse <[email protected]>","scripts": {- "postinstall": "pnpm --filter './packages/*' run build",+ "postinstall": "pnpm --filter './packages/js/*' run build","preeslint": "pnpm --filter '@openverse/eslint-plugin' run build",- "eslint": "eslint --ext .js,.ts,.vue,.json,.json5 --ignore-path .gitignore --ignore-path .eslintignore --max-warnings=0 frontend automations/js packages .pnpmfile.cjs .eslintrc.js prettier.config.js tsconfig.base.json"+ "eslint": "eslint --ext .js,.ts,.vue,.json,.json5 --ignore-path .gitignore --ignore-path .eslintignore --max-warnings=0 frontend automations/js packages/js .pnpmfile.cjs .eslintrc.js prettier.config.js tsconfig.base.json"},"packageManager": "[email protected]","engines": {diff --git a/packages/eslint-plugin/.swcrc b/packages/js/eslint-plugin/.swcrcsimilarity index 100%rename from packages/eslint-plugin/.swcrcrename to packages/js/eslint-plugin/.swcrcdiff --git a/packages/eslint-plugin/README.md b/packages/js/eslint-plugin/README.mdsimilarity index 100%rename from packages/eslint-plugin/README.mdrename to packages/js/eslint-plugin/README.mddiff --git a/packages/eslint-plugin/jest.config.js b/packages/js/eslint-plugin/jest.config.jssimilarity index 100%rename from packages/eslint-plugin/jest.config.jsrename to packages/js/eslint-plugin/jest.config.jsdiff --git a/packages/eslint-plugin/package.json b/packages/js/eslint-plugin/package.jsonsimilarity index 100%rename from packages/eslint-plugin/package.jsonrename to packages/js/eslint-plugin/package.jsondiff --git a/packages/eslint-plugin/src/configs/custom.ts b/packages/js/eslint-plugin/src/configs/custom.tssimilarity index 100%rename from packages/eslint-plugin/src/configs/custom.tsrename to packages/js/eslint-plugin/src/configs/custom.tsdiff --git a/packages/eslint-plugin/src/configs/import.ts b/packages/js/eslint-plugin/src/configs/import.tssimilarity index 97%rename from packages/eslint-plugin/src/configs/import.tsrename to packages/js/eslint-plugin/src/configs/import.tsindex bcab27231..ab5b0af30 100644--- a/packages/eslint-plugin/src/configs/import.ts+++ b/packages/js/eslint-plugin/src/configs/import.ts@@ -82,11 +82,11 @@ export = {},},{- files: ["packages/**"],+ files: ["packages/js/**"],settings: {"import/resolver": {typescript: {- project: "packages/*/tsconfig.json",+ project: "packages/js/*/tsconfig.json",},},},diff --git a/packages/eslint-plugin/src/configs/index.ts b/packages/js/eslint-plugin/src/configs/index.tssimilarity index 98%rename from packages/eslint-plugin/src/configs/index.tsrename to packages/js/eslint-plugin/src/configs/index.tsindex 8baabe7da..30a673edd 100644--- a/packages/eslint-plugin/src/configs/index.ts+++ b/packages/js/eslint-plugin/src/configs/index.ts@@ -43,7 +43,7 @@ export const project: TSESLint.Linter.Config = {},{env: { jest: true },- files: ["packages/**/*/test", "frontend/test/unit/**"],+ files: ["packages/js/**/*/test", "frontend/test/unit/**"],plugins: ["jest"],extends: ["plugin:jest/recommended"],rules: {diff --git a/packages/eslint-plugin/src/configs/typescript.ts b/packages/js/eslint-plugin/src/configs/typescript.tssimilarity index 100%rename from packages/eslint-plugin/src/configs/typescript.tsrename to packages/js/eslint-plugin/src/configs/typescript.tsdiff --git a/packages/eslint-plugin/src/configs/vue.ts b/packages/js/eslint-plugin/src/configs/vue.tssimilarity index 100%rename from packages/eslint-plugin/src/configs/vue.tsrename to packages/js/eslint-plugin/src/configs/vue.tsdiff --git a/packages/eslint-plugin/src/index.ts b/packages/js/eslint-plugin/src/index.tssimilarity index 100%rename from packages/eslint-plugin/src/index.tsrename to packages/js/eslint-plugin/src/index.tsdiff --git a/packages/eslint-plugin/src/rules/analytics-configuration.ts b/packages/js/eslint-plugin/src/rules/analytics-configuration.tssimilarity index 100%rename from packages/eslint-plugin/src/rules/analytics-configuration.tsrename to packages/js/eslint-plugin/src/rules/analytics-configuration.tsdiff --git a/packages/eslint-plugin/src/rules/index.ts b/packages/js/eslint-plugin/src/rules/index.tssimilarity index 100%rename from packages/eslint-plugin/src/rules/index.tsrename to packages/js/eslint-plugin/src/rules/index.tsdiff --git a/packages/eslint-plugin/src/rules/no-unexplained-disabled-test.ts b/packages/js/eslint-plugin/src/rules/no-unexplained-disabled-test.tssimilarity index 100%rename from packages/eslint-plugin/src/rules/no-unexplained-disabled-test.tsrename to packages/js/eslint-plugin/src/rules/no-unexplained-disabled-test.tsdiff --git a/packages/eslint-plugin/src/rules/translation-strings.ts b/packages/js/eslint-plugin/src/rules/translation-strings.tssimilarity index 100%rename from packages/eslint-plugin/src/rules/translation-strings.tsrename to packages/js/eslint-plugin/src/rules/translation-strings.tsdiff --git a/packages/eslint-plugin/src/utils/rule-creator.ts b/packages/js/eslint-plugin/src/utils/rule-creator.tssimilarity index 66%rename from packages/eslint-plugin/src/utils/rule-creator.tsrename to packages/js/eslint-plugin/src/utils/rule-creator.tsindex f12c0e5e5..ee9b55357 100644--- a/packages/eslint-plugin/src/utils/rule-creator.ts+++ b/packages/js/eslint-plugin/src/utils/rule-creator.ts@@ -2,7 +2,7 @@ import { ESLintUtils } from "@typescript-eslint/utils"export const OpenverseRule = ESLintUtils.RuleCreator((ruleName) =>- `https://docs.openverse.org/packages/eslint_plugin/${ruleName.replaceAll(+ `https://docs.openverse.org/packages/js/eslint_plugin/${ruleName.replaceAll("-","_")}.html`diff --git a/packages/eslint-plugin/test/rules/analytics-configuration.spec.ts b/packages/js/eslint-plugin/test/rules/analytics-configuration.spec.tssimilarity index 100%rename from packages/eslint-plugin/test/rules/analytics-configuration.spec.tsrename to packages/js/eslint-plugin/test/rules/analytics-configuration.spec.tsdiff --git a/packages/eslint-plugin/test/rules/no-unexplained-disabled-test.spec.ts b/packages/js/eslint-plugin/test/rules/no-unexplained-disabled-test.spec.tssimilarity index 100%rename from packages/eslint-plugin/test/rules/no-unexplained-disabled-test.spec.tsrename to packages/js/eslint-plugin/test/rules/no-unexplained-disabled-test.spec.tsdiff --git a/packages/eslint-plugin/test/rules/translation-strings.spec.ts b/packages/js/eslint-plugin/test/rules/translation-strings.spec.tssimilarity index 100%rename from packages/eslint-plugin/test/rules/translation-strings.spec.tsrename to packages/js/eslint-plugin/test/rules/translation-strings.spec.tsdiff --git a/packages/eslint-plugin/tsconfig.json b/packages/js/eslint-plugin/tsconfig.jsonsimilarity index 84%rename from packages/eslint-plugin/tsconfig.jsonrename to packages/js/eslint-plugin/tsconfig.jsonindex 81f5e9760..b2fc9635d 100644--- a/packages/eslint-plugin/tsconfig.json+++ b/packages/js/eslint-plugin/tsconfig.json@@ -1,5 +1,5 @@{- "extends": "../../tsconfig.base.json",+ "extends": "../../../tsconfig.base.json","compilerOptions": {"module": "NodeNext","noEmit": true,diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex 54890b6a6..e2bf34173 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -10,7 +10,7 @@ importers:devDependencies:'@openverse/eslint-plugin':specifier: workspace:0.0.0- version: link:packages/eslint-plugin+ version: link:packages/js/eslint-pluginprettier:specifier: 3.2.5version: 3.2.5@@ -311,7 +311,7 @@ importers:specifier: ^4.46.0version: 4.46.0- packages/eslint-plugin:+ packages/js/eslint-plugin:dependencies:'@intlify/eslint-plugin-vue-i18n':specifier: ^2.0.0diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yamlindex f202b4f5f..e94175faa 100644--- a/pnpm-workspace.yaml+++ b/pnpm-workspace.yaml@@ -1,4 +1,4 @@packages:- automations/js/- frontend/- - packages/*+ - packages/js/*diff --git a/tsconfig.base.json b/tsconfig.base.jsonindex cc5c9d24f..e0fb1ace2 100644--- a/tsconfig.base.json+++ b/tsconfig.base.json@@ -13,7 +13,7 @@"noImplicitReturns": true,"noFallthroughCasesInSwitch": true,"paths": {- "@openverse/*": ["./packages/*/src"]+ "@openverse/*": ["./packages/js/*/src"]},/**