Skip to content

Commit 6c06a70

Browse files
committed
chore: add lint autofix CI job (#9604)
1 parent 839ccbd commit 6c06a70

File tree

7 files changed

+595
-548
lines changed

7 files changed

+595
-548
lines changed

.github/workflows/lint-autofix.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Lint AutoFix
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
- docusaurus-v**
8+
9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
11+
cancel-in-progress: true
12+
13+
jobs:
14+
lint-autofix:
15+
name: Lint AutoFix
16+
runs-on: ubuntu-latest
17+
18+
permissions:
19+
contents: write
20+
21+
steps:
22+
- uses: actions/checkout@v4
23+
with:
24+
ref: ${{ github.head_ref }}
25+
26+
- name: Installation
27+
run: yarn
28+
29+
- name: AutoFix Format
30+
run: yarn format
31+
32+
- name: AutoFix JS
33+
run: yarn lint:js:fix
34+
35+
- name: AutoFix Style
36+
run: yarn lint:style:fix
37+
38+
- name: AutoFix Spelling
39+
run: yarn lint:spelling:fix
40+
41+
- uses: stefanzweifel/git-auto-commit-action@v5
42+
with:
43+
commit_message: 'refactor: apply lint autofix'

.lintstagedrc.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
{
22
"*.{js,jsx,ts,tsx,mjs}": ["eslint --fix"],
33
"*.css": ["stylelint --allow-empty-input --fix"],
4-
"*": [
5-
"prettier --ignore-unknown --write",
6-
"cspell --no-must-find-files --no-progress"
7-
]
4+
"*": ["prettier --ignore-unknown --write"]
85
}

.prettierignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,5 @@ website/versioned_sidebars/*.json
2424
examples/
2525
website/static/katex/katex.min.css
2626

27-
website/changelog/_swizzle_theme_tests
27+
website/changelog
2828
website/_dogfooding/_swizzle_theme_tests

package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,11 @@
5151
"lint": "yarn lint:js && yarn lint:style && yarn lint:spelling",
5252
"lint:ci": "yarn lint:js --quiet && yarn lint:style && yarn lint:spelling",
5353
"lint:js": "eslint --cache --report-unused-disable-directives \"**/*.{js,jsx,ts,tsx,mjs}\"",
54-
"lint:spelling": "cspell \"**\" --no-progress",
54+
"lint:js:fix": "yarn lint:js --fix",
55+
"lint:spelling": "cspell \"**\" --no-progress --show-context --show-suggestions",
56+
"lint:spelling:fix": "yarn rimraf project-words.txt && echo \"# Project Words - DO NOT TOUCH - This is updated through CI\" >> project-words.txt && yarn -s lint:spelling --words-only --unique --no-exit-code --no-summary \"**\" | sort --ignore-case >> project-words.txt",
5557
"lint:style": "stylelint \"**/*.css\"",
58+
"lint:style:fix": "yarn lint:style --fix",
5659
"lerna": "lerna",
5760
"test": "jest",
5861
"test:build:website": "./admin/scripts/test-release.sh",
@@ -80,7 +83,7 @@
8083
"@typescript-eslint/eslint-plugin": "^5.62.0",
8184
"@typescript-eslint/parser": "^5.62.0",
8285
"cross-env": "^7.0.3",
83-
"cspell": "^6.31.2",
86+
"cspell": "^8.1.0",
8487
"eslint": "^8.45.0",
8588
"eslint-config-airbnb": "^19.0.4",
8689
"eslint-config-prettier": "^8.8.0",

packages/docusaurus-theme-search-algolia/src/theme/SearchBar/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
*/
77

88
import React, {useCallback, useMemo, useRef, useState} from 'react';
9+
import {createPortal} from 'react-dom';
910
import {DocSearchButton, useDocSearchKeyboardEvents} from '@docsearch/react';
1011
import Head from '@docusaurus/Head';
1112
import Link from '@docusaurus/Link';
@@ -20,7 +21,6 @@ import {
2021
} from '@docusaurus/theme-search-algolia/client';
2122
import Translate from '@docusaurus/Translate';
2223
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
23-
import {createPortal} from 'react-dom';
2424
import translations from '@theme/SearchTranslations';
2525

2626
import type {AutocompleteState} from '@algolia/autocomplete-core';

0 commit comments

Comments
 (0)