@wistia/eslint-config 0.43.0 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (101) hide show
  1. package/.changeset/README.md +8 -0
  2. package/.changeset/config.json +12 -0
  3. package/.github/actions/setup-node-env/action.yml +40 -0
  4. package/.github/dependabot.yml +10 -0
  5. package/.github/workflows/commitlint.yml +33 -0
  6. package/.github/workflows/lint.yml +31 -0
  7. package/.github/workflows/publish-branch-package.yml +36 -0
  8. package/.github/workflows/release.yml +50 -0
  9. package/.github/workflows/test.yml +34 -0
  10. package/.husky/commit-msg +1 -0
  11. package/.prettierrc.json +6 -0
  12. package/.tool-versions +2 -0
  13. package/.yarn/releases/yarn-4.9.2.cjs +942 -0
  14. package/.yarnrc.yml +7 -0
  15. package/CHANGELOG.md +137 -0
  16. package/catalog-info.yaml +17 -0
  17. package/commitlint.config.mjs +8 -0
  18. package/eslint.config.mjs +35 -0
  19. package/mkdocs.yaml +10 -0
  20. package/package.json +75 -57
  21. package/prettier.config.mjs +12 -0
  22. package/src/configs/javascript.mjs +52 -0
  23. package/src/configs/jest.mjs +22 -0
  24. package/src/configs/node.mjs +21 -0
  25. package/src/configs/react-ssr-compatibility.mjs +18 -0
  26. package/src/configs/react.mjs +39 -0
  27. package/src/configs/storybook.mjs +18 -0
  28. package/src/configs/styled-components.mjs +20 -0
  29. package/src/configs/testing-library.mjs +17 -0
  30. package/src/configs/typescript.mjs +80 -0
  31. package/src/configs/vitest.mjs +25 -0
  32. package/src/rules/base.mjs +1045 -0
  33. package/src/rules/filenames.mjs +17 -0
  34. package/src/rules/import.mjs +266 -0
  35. package/src/rules/jest-dom.mjs +48 -0
  36. package/src/rules/jest-formatting.mjs +36 -0
  37. package/src/rules/jest.mjs +203 -0
  38. package/src/rules/node.mjs +184 -0
  39. package/src/rules/promise.mjs +75 -0
  40. package/src/rules/react-a11y.mjs +253 -0
  41. package/src/rules/react-hooks.mjs +72 -0
  42. package/src/rules/react-ssr-compatibility.mjs +35 -0
  43. package/src/rules/react.mjs +595 -0
  44. package/src/rules/storybook.mjs +75 -0
  45. package/src/rules/styled-components.mjs +80 -0
  46. package/src/rules/stylistic.mjs +493 -0
  47. package/src/rules/testing-library.mjs +126 -0
  48. package/src/rules/typescript.mjs +702 -0
  49. package/src/rules/vitest.mjs +224 -0
  50. package/test/__snapshots__/javascript.mjs.snap +1958 -0
  51. package/test/__snapshots__/jest.mjs.snap +209 -0
  52. package/test/__snapshots__/node.mjs.snap +240 -0
  53. package/test/__snapshots__/prettier.mjs.snap +1098 -0
  54. package/test/__snapshots__/react-ssr-compatibility.mjs.snap +40 -0
  55. package/test/__snapshots__/react.mjs.snap +2017 -0
  56. package/test/__snapshots__/storybook.mjs.snap +92 -0
  57. package/test/__snapshots__/styled-components.mjs.snap +179 -0
  58. package/test/__snapshots__/testing-library.mjs.snap +146 -0
  59. package/test/__snapshots__/typescript.mjs.snap +2449 -0
  60. package/test/__snapshots__/vitest.mjs.snap +230 -0
  61. package/test/exports-are-esm.test.mjs +32 -0
  62. package/test/validate-configs.test.mjs +58 -0
  63. package/test/validate-exports.test.mjs +221 -0
  64. package/test/validate-rules.test.mjs +54 -0
  65. package/vitest.config.mjs +8 -0
  66. package/configs/eslint/default.cjs +0 -21
  67. package/configs/eslint/functional-programming.cjs +0 -9
  68. package/configs/eslint/jest.cjs +0 -10
  69. package/configs/eslint/node.cjs +0 -9
  70. package/configs/eslint/prettier.cjs +0 -5
  71. package/configs/eslint/react.cjs +0 -19
  72. package/configs/eslint/ssr-compatibility.cjs +0 -9
  73. package/configs/eslint/storybook.cjs +0 -9
  74. package/configs/eslint/strict.cjs +0 -5
  75. package/configs/eslint/styled-components.cjs +0 -5
  76. package/configs/eslint/testing-library.cjs +0 -5
  77. package/configs/eslint/typescript-react.cjs +0 -21
  78. package/configs/eslint/typescript.cjs +0 -23
  79. package/configs/eslint/vitest.cjs +0 -10
  80. package/rules/eslint/best-practices.cjs +0 -706
  81. package/rules/eslint/errors.cjs +0 -212
  82. package/rules/eslint/filenames.cjs +0 -20
  83. package/rules/eslint/functional-programming.cjs +0 -76
  84. package/rules/eslint/imports.cjs +0 -278
  85. package/rules/eslint/jest.cjs +0 -246
  86. package/rules/eslint/node.cjs +0 -188
  87. package/rules/eslint/prettier.cjs +0 -11
  88. package/rules/eslint/promise.cjs +0 -64
  89. package/rules/eslint/react-a11y.cjs +0 -263
  90. package/rules/eslint/react-hooks.cjs +0 -22
  91. package/rules/eslint/react.cjs +0 -667
  92. package/rules/eslint/sonar.cjs +0 -140
  93. package/rules/eslint/ssr-compatibility.cjs +0 -43
  94. package/rules/eslint/storybook.cjs +0 -79
  95. package/rules/eslint/style.cjs +0 -687
  96. package/rules/eslint/styled-components.cjs +0 -90
  97. package/rules/eslint/testing-library.cjs +0 -175
  98. package/rules/eslint/typescript-imports.cjs +0 -40
  99. package/rules/eslint/typescript-react.cjs +0 -23
  100. package/rules/eslint/typescript.cjs +0 -792
  101. package/rules/eslint/vitest.cjs +0 -261
@@ -0,0 +1,8 @@
1
+ # Changesets
2
+
3
+ Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
4
+ with multi-package repos, or single-package repos to help you version and publish your code. You can
5
+ find the full documentation for it [in our repository](https://github.com/changesets/changesets)
6
+
7
+ We have a quick list of common questions to get you started engaging with this project in
8
+ [our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
@@ -0,0 +1,12 @@
1
+ {
2
+ "$schema": "https://unpkg.com/@changesets/config@3.0.2/schema.json",
3
+ "changelog": ["@changesets/changelog-github", { "repo": "wistia/eslint-config" }],
4
+ "commit": false,
5
+ "commitMessage": "${type}(${scope}): ${description}",
6
+ "fixed": [],
7
+ "linked": [],
8
+ "access": "public",
9
+ "baseBranch": "main",
10
+ "updateInternalDependencies": "patch",
11
+ "ignore": []
12
+ }
@@ -0,0 +1,40 @@
1
+ name: 'Installs node, yarn and node modules.'
2
+ description: 'Installs node, yarn and node modules. Caches node modules.'
3
+ inputs:
4
+ cache-prefix:
5
+ description: 'A prefix you can use to prevent cache collisions in incompatible environments'
6
+ required: false
7
+ default: 'cache'
8
+ token:
9
+ description: 'Optional GitHub token (eg. PAT)'
10
+ required: false
11
+ default: ${{ github.token }}
12
+
13
+ runs:
14
+ using: 'composite'
15
+ steps:
16
+ - name: Parse .tool-versions
17
+ uses: wistia/parse-tool-versions@v2.1.1
18
+ with:
19
+ prefix: 'TOOL_VERSION_'
20
+
21
+ - name: Set up NodeJS environment
22
+ uses: actions/setup-node@v6
23
+ with:
24
+ node-version: ${{ env.TOOL_VERSION_NODEJS }}
25
+
26
+ - name: Cache node_modules
27
+ uses: actions/cache@v4
28
+ id: node-modules-cache
29
+ with:
30
+ path: |
31
+ ${{ inputs.working-directory }}/node_modules
32
+ key: |
33
+ ${{ inputs.cache-prefix }}-node${{ env.TOOL_VERSION_NODEJS }}-${{ hashFiles('yarn.lock', '.github/actions/setup-node-env/action.yml') }}
34
+ restore-keys: |
35
+ ${{ inputs.cache-prefix }}-node${{ env.TOOL_VERSION_NODEJS }}-
36
+
37
+ - name: Install npm packages
38
+ if: steps.node-modules-cache.outputs.cache-hit != 'true'
39
+ run: yarn install --immutable
40
+ shell: bash
@@ -0,0 +1,10 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: 'github-actions'
4
+ directories:
5
+ - '/.github/actions/**/*'
6
+ - '/.github/workflows/**/*'
7
+ schedule:
8
+ interval: 'weekly'
9
+ commit-message:
10
+ prefix: 'ci(github)'
@@ -0,0 +1,33 @@
1
+ name: Commitlint
2
+
3
+ on:
4
+ pull_request:
5
+ branches:
6
+ - main
7
+
8
+ concurrency:
9
+ group: ${{ github.workflow }}-${{ github.head_ref }}
10
+ cancel-in-progress: true
11
+
12
+ permissions:
13
+ checks: write
14
+ contents: read
15
+ pull-requests: read
16
+
17
+ jobs:
18
+ commitlint:
19
+ runs-on: ubuntu-22.04
20
+ timeout-minutes: 5
21
+ steps:
22
+ - name: Check out Git repository
23
+ uses: actions/checkout@v6
24
+ with:
25
+ # by default this only fetches the latest commit,
26
+ # but more commits are needed to validate a range of commit messages
27
+ fetch-depth: 0
28
+
29
+ - name: Validate commit messages
30
+ uses: wagoid/commitlint-github-action@v6
31
+ with:
32
+ configFile: .commitlintrc.mjs
33
+ helpURL: https://github.com/conventional-changelog/commitlint/#what-is-commitlint
@@ -0,0 +1,31 @@
1
+ name: Lint
2
+
3
+ on:
4
+ pull_request:
5
+ branches:
6
+ - main
7
+
8
+ concurrency:
9
+ group: ${{ github.workflow }}-${{ github.head_ref }}
10
+ cancel-in-progress: true
11
+
12
+ permissions:
13
+ checks: write
14
+ contents: read
15
+ pull-requests: read
16
+
17
+ jobs:
18
+ lint:
19
+ runs-on: ubuntu-22.04
20
+ timeout-minutes: 5
21
+ steps:
22
+ - name: Check out Git repository
23
+ uses: actions/checkout@v6
24
+ with:
25
+ ref: ${{ github.event.pull_request.head.sha || github.ref }}
26
+
27
+ - name: Install Node and npm packages
28
+ uses: ./.github/actions/setup-node-env
29
+
30
+ - name: Run ESLint
31
+ run: yarn lint
@@ -0,0 +1,36 @@
1
+ name: Publish branch package
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ inputs:
6
+ commit_hash:
7
+ description: 'SHA-1 hash of the commit to publish'
8
+ required: true
9
+
10
+ concurrency:
11
+ group: ${{ github.workflow }}-${{ github.head_ref }}
12
+ cancel-in-progress: true
13
+
14
+ permissions:
15
+ contents: read
16
+ pull-requests: write
17
+
18
+ jobs:
19
+ publish-branch-package:
20
+ runs-on: ubuntu-22.04
21
+ timeout-minutes: 5
22
+ steps:
23
+ - name: Check out Git repository
24
+ uses: actions/checkout@v6
25
+ with:
26
+ ref: ${{ github.event.inputs.commit_hash || github.event.pull_request.head.sha || github.sha }}
27
+
28
+ - name: Install Node and npm packages
29
+ uses: ./.github/actions/setup-node-env
30
+
31
+ - name: Publish branch package to npm
32
+ uses: wistia/publish-branch-to-npm@v2.3.5
33
+ with:
34
+ github_token: ${{ secrets.GITHUB_TOKEN }}
35
+ npm_token: ${{ secrets.NPM_AUTH_TOKEN }}
36
+ commit_hash: ${{ github.event.inputs.commit_hash || github.event.pull_request.head.sha || github.sha }}
@@ -0,0 +1,50 @@
1
+ name: Create Release Pull Request or Publish to npm
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+
8
+ concurrency:
9
+ group: ${{ github.workflow }}-${{ github.head_ref }}
10
+ cancel-in-progress: true
11
+
12
+ permissions:
13
+ contents: write
14
+ id-token: write
15
+ issues: read
16
+ packages: write
17
+ pull-requests: write
18
+
19
+ jobs:
20
+ release:
21
+ runs-on: ubuntu-22.04
22
+ timeout-minutes: 5
23
+ steps:
24
+ - name: Check out Git repository
25
+ uses: actions/checkout@v6
26
+ with:
27
+ # This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
28
+ fetch-depth: 0
29
+
30
+ - name: Install Node and npm packages
31
+ uses: ./.github/actions/setup-node-env
32
+
33
+ # this is a hack but at this time it's the only way to get the changeset version for the
34
+ # commit message in the next step. using `changeset status` it generates a `release.json` file,
35
+ # then reads the new version from it and then removes the file
36
+ - name: Get new package version
37
+ run: |
38
+ echo "NEW_PACKAGE_VERSION=$(yarn changeset status --output=release.json && jq -r '.releases[0].newVersion' release.json && rm release.json)" >> "$GITHUB_ENV"
39
+
40
+ - name: Create Release Pull Request or Publish to npm
41
+ uses: changesets/action@v1
42
+ id: changesets
43
+ with:
44
+ createGithubReleases: true
45
+ publish: yarn release
46
+ title: "chore: release v${{env.NEW_PACKAGE_VERSION}}"
47
+ commit: "chore: release v${{env.NEW_PACKAGE_VERSION}}"
48
+ env:
49
+ GITHUB_TOKEN: ${{ secrets.WISTIA_GITHUB_BOT_TOKEN }}
50
+ NPM_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
@@ -0,0 +1,34 @@
1
+ name: Test
2
+
3
+ on:
4
+ pull_request:
5
+ branches:
6
+ - main
7
+
8
+ concurrency:
9
+ group: ${{ github.workflow }}-${{ github.head_ref }}
10
+ cancel-in-progress: true
11
+
12
+ permissions:
13
+ checks: write
14
+ contents: read
15
+ pull-requests: write
16
+
17
+ jobs:
18
+ test:
19
+ runs-on: ubuntu-22.04
20
+ timeout-minutes: 5
21
+ steps:
22
+ - name: Check out Git repository
23
+ uses: actions/checkout@v6
24
+ with:
25
+ ref: ${{ github.event.pull_request.head.sha || github.ref }}
26
+
27
+ - name: Install Node and npm packages
28
+ uses: ./.github/actions/setup-node-env
29
+
30
+ - name: Run tests
31
+ run: yarn test
32
+
33
+ - name: Check export map
34
+ run: yarn test:export
@@ -0,0 +1 @@
1
+ yarn commitlint --edit $1
@@ -0,0 +1,6 @@
1
+ {
2
+ "printWidth": 100,
3
+ "singleQuote": true,
4
+ "trailingComma": "all",
5
+ "singleAttributePerLine": true
6
+ }
package/.tool-versions ADDED
@@ -0,0 +1,2 @@
1
+ nodejs 24.9.0
2
+ yarn 1.22.22