diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 345c0775..7010f1b7 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,8 +1,6 @@ ## Checks - [ ] I have read the [contributing guidelines](https://github.com/testing-library/eslint-plugin-testing-library/blob/main/CONTRIBUTING.md). -- [ ] If some rule is added/updated/removed, I've regenerated the rules list (`npm run generate:rules-list`) -- [ ] If some rule meta info is changed, I've regenerated the plugin shared configs (`npm run generate:configs`) ## Changes diff --git a/.github/workflows/pipeline.yml b/.github/workflows/pipeline.yml index 2a59061c..35932ecf 100644 --- a/.github/workflows/pipeline.yml +++ b/.github/workflows/pipeline.yml @@ -45,6 +45,9 @@ jobs: - name: Check format run: npm run format:check + - name: Check autogenerated docs + run: npm run docs:gen && npm run format && git diff --exit-code + tests: name: Tests (Node v${{ matrix.node }} - ESLint v${{ matrix.eslint }}) runs-on: ubuntu-latest diff --git a/package.json b/package.json index 15fa0632..e728b410 100644 --- a/package.json +++ b/package.json @@ -28,16 +28,16 @@ "scripts": { "build": "tsc", "postbuild": "cpy README.md ./dist && cpy package.json ./dist && cpy LICENSE ./dist", - "format": "prettier --write .", - "format:check": "prettier --check .", - "generate": "npm-run-all \"generate:*\"", - "generate:configs": "ts-node tools/generate-configs && npm run format", - "generate:rules-list": "npm run build && eslint-doc-generator --path-rule-list \"../README.md\" --path-rule-doc \"../docs/rules/{name}.md\" --url-rule-doc \"docs/rules/{name}.md\" dist/ && npm run format", - "lint": "npm-run-all \"lint:*\"", - "lint:generate": "npm run generate && git diff --exit-code", - "lint:js": "eslint . --max-warnings 0 --ext .js,.ts", - "lint:js:fix": "npm run lint:js -- --fix", + "docs:gen": "run-p \"docs:gen:*\"", + "docs:gen:configs": "ts-node tools/generate-configs", + "docs:gen:rules-list": "npm run build && npm run rule-doc-generator && npm run format", + "format": "npm run prettier-base -- --write", + "format:check": "npm run prettier-base -- --check", + "lint": "eslint . --max-warnings 0 --ext .js,.ts", + "lint:fix": "npm run lint -- --fix", "prepare": "is-ci || husky install", + "prettier-base": "prettier . --ignore-unknown --cache --loglevel warn", + "rule-doc-generator": "eslint-doc-generator --path-rule-list \"../README.md\" --path-rule-doc \"../docs/rules/{name}.md\" --url-rule-doc \"docs/rules/{name}.md\" dist/", "semantic-release": "semantic-release", "test": "jest", "test:ci": "jest --ci --coverage", diff --git a/tests/__snapshots__/index.test.ts.snap b/tests/__snapshots__/index.test.ts.snap deleted file mode 100644 index 3a191824..00000000 --- a/tests/__snapshots__/index.test.ts.snap +++ /dev/null @@ -1,141 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should have run 'generate:configs' script when changing config rules 1`] = ` -Object { - "angular": Object { - "plugins": Array [ - "testing-library", - ], - "rules": Object { - "testing-library/await-async-query": "error", - "testing-library/await-async-utils": "error", - "testing-library/no-await-sync-query": "error", - "testing-library/no-container": "error", - "testing-library/no-debugging-utils": "error", - "testing-library/no-dom-import": Array [ - "error", - "angular", - ], - "testing-library/no-node-access": "error", - "testing-library/no-promise-in-fire-event": "error", - "testing-library/no-render-in-setup": "error", - "testing-library/no-wait-for-empty-callback": "error", - "testing-library/no-wait-for-multiple-assertions": "error", - "testing-library/no-wait-for-side-effects": "error", - "testing-library/no-wait-for-snapshot": "error", - "testing-library/prefer-find-by": "error", - "testing-library/prefer-presence-queries": "error", - "testing-library/prefer-query-by-disappearance": "error", - "testing-library/prefer-screen-queries": "error", - "testing-library/render-result-naming-convention": "error", - }, - }, - "dom": Object { - "plugins": Array [ - "testing-library", - ], - "rules": Object { - "testing-library/await-async-query": "error", - "testing-library/await-async-utils": "error", - "testing-library/no-await-sync-query": "error", - "testing-library/no-promise-in-fire-event": "error", - "testing-library/no-wait-for-empty-callback": "error", - "testing-library/no-wait-for-multiple-assertions": "error", - "testing-library/no-wait-for-side-effects": "error", - "testing-library/no-wait-for-snapshot": "error", - "testing-library/prefer-find-by": "error", - "testing-library/prefer-presence-queries": "error", - "testing-library/prefer-query-by-disappearance": "error", - "testing-library/prefer-screen-queries": "error", - }, - }, - "marko": Object { - "plugins": Array [ - "testing-library", - ], - "rules": Object { - "testing-library/await-async-query": "error", - "testing-library/await-async-utils": "error", - "testing-library/await-fire-event": "error", - "testing-library/no-await-sync-query": "error", - "testing-library/no-container": "error", - "testing-library/no-debugging-utils": "error", - "testing-library/no-dom-import": Array [ - "error", - "marko", - ], - "testing-library/no-node-access": "error", - "testing-library/no-promise-in-fire-event": "error", - "testing-library/no-render-in-setup": "error", - "testing-library/no-unnecessary-act": "error", - "testing-library/no-wait-for-empty-callback": "error", - "testing-library/no-wait-for-multiple-assertions": "error", - "testing-library/no-wait-for-side-effects": "error", - "testing-library/no-wait-for-snapshot": "error", - "testing-library/prefer-find-by": "error", - "testing-library/prefer-presence-queries": "error", - "testing-library/prefer-query-by-disappearance": "error", - "testing-library/prefer-screen-queries": "error", - "testing-library/render-result-naming-convention": "error", - }, - }, - "react": Object { - "plugins": Array [ - "testing-library", - ], - "rules": Object { - "testing-library/await-async-query": "error", - "testing-library/await-async-utils": "error", - "testing-library/no-await-sync-query": "error", - "testing-library/no-container": "error", - "testing-library/no-debugging-utils": "error", - "testing-library/no-dom-import": Array [ - "error", - "react", - ], - "testing-library/no-node-access": "error", - "testing-library/no-promise-in-fire-event": "error", - "testing-library/no-render-in-setup": "error", - "testing-library/no-unnecessary-act": "error", - "testing-library/no-wait-for-empty-callback": "error", - "testing-library/no-wait-for-multiple-assertions": "error", - "testing-library/no-wait-for-side-effects": "error", - "testing-library/no-wait-for-snapshot": "error", - "testing-library/prefer-find-by": "error", - "testing-library/prefer-presence-queries": "error", - "testing-library/prefer-query-by-disappearance": "error", - "testing-library/prefer-screen-queries": "error", - "testing-library/render-result-naming-convention": "error", - }, - }, - "vue": Object { - "plugins": Array [ - "testing-library", - ], - "rules": Object { - "testing-library/await-async-query": "error", - "testing-library/await-async-utils": "error", - "testing-library/await-fire-event": "error", - "testing-library/no-await-sync-query": "error", - "testing-library/no-container": "error", - "testing-library/no-debugging-utils": "error", - "testing-library/no-dom-import": Array [ - "error", - "vue", - ], - "testing-library/no-node-access": "error", - "testing-library/no-promise-in-fire-event": "error", - "testing-library/no-render-in-setup": "error", - "testing-library/no-wait-for-empty-callback": "error", - "testing-library/no-wait-for-multiple-assertions": "error", - "testing-library/no-wait-for-side-effects": "error", - "testing-library/no-wait-for-snapshot": "error", - "testing-library/prefer-find-by": "error", - "testing-library/prefer-presence-queries": "error", - "testing-library/prefer-query-by-disappearance": "error", - "testing-library/prefer-screen-queries": "error", - "testing-library/render-result-naming-convention": "error", - }, - }, -} -`; diff --git a/tests/index.test.ts b/tests/index.test.ts index 6e490f2b..2b738922 100644 --- a/tests/index.test.ts +++ b/tests/index.test.ts @@ -1,13 +1,8 @@ -import { exec } from 'child_process'; import { existsSync } from 'fs'; import { resolve } from 'path'; -import util from 'util'; import plugin from '../lib'; -const execAsync = util.promisify(exec); -const generateConfigs = () => execAsync(`npm run generate:configs`); - const numberOfRules = 27; const ruleNames = Object.keys(plugin.rules); @@ -48,13 +43,6 @@ it('should have the correct amount of rules', () => { } }); -it("should have run 'generate:configs' script when changing config rules", async () => { - await generateConfigs(); - - const allConfigs = plugin.configs; - expect(allConfigs).toMatchSnapshot(); -}, 20000); - it('should export configs that refer to actual rules', () => { const allConfigs = plugin.configs;