@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.
- package/.changeset/README.md +8 -0
- package/.changeset/config.json +12 -0
- package/.github/actions/setup-node-env/action.yml +40 -0
- package/.github/dependabot.yml +10 -0
- package/.github/workflows/commitlint.yml +33 -0
- package/.github/workflows/lint.yml +31 -0
- package/.github/workflows/publish-branch-package.yml +36 -0
- package/.github/workflows/release.yml +50 -0
- package/.github/workflows/test.yml +34 -0
- package/.husky/commit-msg +1 -0
- package/.prettierrc.json +6 -0
- package/.tool-versions +2 -0
- package/.yarn/releases/yarn-4.9.2.cjs +942 -0
- package/.yarnrc.yml +7 -0
- package/CHANGELOG.md +137 -0
- package/catalog-info.yaml +17 -0
- package/commitlint.config.mjs +8 -0
- package/eslint.config.mjs +35 -0
- package/mkdocs.yaml +10 -0
- package/package.json +75 -57
- package/prettier.config.mjs +12 -0
- package/src/configs/javascript.mjs +52 -0
- package/src/configs/jest.mjs +22 -0
- package/src/configs/node.mjs +21 -0
- package/src/configs/react-ssr-compatibility.mjs +18 -0
- package/src/configs/react.mjs +39 -0
- package/src/configs/storybook.mjs +18 -0
- package/src/configs/styled-components.mjs +20 -0
- package/src/configs/testing-library.mjs +17 -0
- package/src/configs/typescript.mjs +80 -0
- package/src/configs/vitest.mjs +25 -0
- package/src/rules/base.mjs +1045 -0
- package/src/rules/filenames.mjs +17 -0
- package/src/rules/import.mjs +266 -0
- package/src/rules/jest-dom.mjs +48 -0
- package/src/rules/jest-formatting.mjs +36 -0
- package/src/rules/jest.mjs +203 -0
- package/src/rules/node.mjs +184 -0
- package/src/rules/promise.mjs +75 -0
- package/src/rules/react-a11y.mjs +253 -0
- package/src/rules/react-hooks.mjs +72 -0
- package/src/rules/react-ssr-compatibility.mjs +35 -0
- package/src/rules/react.mjs +595 -0
- package/src/rules/storybook.mjs +75 -0
- package/src/rules/styled-components.mjs +80 -0
- package/src/rules/stylistic.mjs +493 -0
- package/src/rules/testing-library.mjs +126 -0
- package/src/rules/typescript.mjs +702 -0
- package/src/rules/vitest.mjs +224 -0
- package/test/__snapshots__/javascript.mjs.snap +1958 -0
- package/test/__snapshots__/jest.mjs.snap +209 -0
- package/test/__snapshots__/node.mjs.snap +240 -0
- package/test/__snapshots__/prettier.mjs.snap +1098 -0
- package/test/__snapshots__/react-ssr-compatibility.mjs.snap +40 -0
- package/test/__snapshots__/react.mjs.snap +2017 -0
- package/test/__snapshots__/storybook.mjs.snap +92 -0
- package/test/__snapshots__/styled-components.mjs.snap +179 -0
- package/test/__snapshots__/testing-library.mjs.snap +146 -0
- package/test/__snapshots__/typescript.mjs.snap +2449 -0
- package/test/__snapshots__/vitest.mjs.snap +230 -0
- package/test/exports-are-esm.test.mjs +32 -0
- package/test/validate-configs.test.mjs +58 -0
- package/test/validate-exports.test.mjs +221 -0
- package/test/validate-rules.test.mjs +54 -0
- package/vitest.config.mjs +8 -0
- package/configs/eslint/default.cjs +0 -21
- package/configs/eslint/functional-programming.cjs +0 -9
- package/configs/eslint/jest.cjs +0 -10
- package/configs/eslint/node.cjs +0 -9
- package/configs/eslint/prettier.cjs +0 -5
- package/configs/eslint/react.cjs +0 -19
- package/configs/eslint/ssr-compatibility.cjs +0 -9
- package/configs/eslint/storybook.cjs +0 -9
- package/configs/eslint/strict.cjs +0 -5
- package/configs/eslint/styled-components.cjs +0 -5
- package/configs/eslint/testing-library.cjs +0 -5
- package/configs/eslint/typescript-react.cjs +0 -21
- package/configs/eslint/typescript.cjs +0 -23
- package/configs/eslint/vitest.cjs +0 -10
- package/rules/eslint/best-practices.cjs +0 -706
- package/rules/eslint/errors.cjs +0 -212
- package/rules/eslint/filenames.cjs +0 -20
- package/rules/eslint/functional-programming.cjs +0 -76
- package/rules/eslint/imports.cjs +0 -278
- package/rules/eslint/jest.cjs +0 -246
- package/rules/eslint/node.cjs +0 -188
- package/rules/eslint/prettier.cjs +0 -11
- package/rules/eslint/promise.cjs +0 -64
- package/rules/eslint/react-a11y.cjs +0 -263
- package/rules/eslint/react-hooks.cjs +0 -22
- package/rules/eslint/react.cjs +0 -667
- package/rules/eslint/sonar.cjs +0 -140
- package/rules/eslint/ssr-compatibility.cjs +0 -43
- package/rules/eslint/storybook.cjs +0 -79
- package/rules/eslint/style.cjs +0 -687
- package/rules/eslint/styled-components.cjs +0 -90
- package/rules/eslint/testing-library.cjs +0 -175
- package/rules/eslint/typescript-imports.cjs +0 -40
- package/rules/eslint/typescript-react.cjs +0 -23
- package/rules/eslint/typescript.cjs +0 -792
- 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,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
|
package/.prettierrc.json
ADDED
package/.tool-versions
ADDED