forked from DTStack/Taier
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[style/ci][taier-ui]improve code style (DTStack#973)
### Introduction - Add eslint, stylelint and prettier to `taier-ui` - format all files in `taier-ui`
- Loading branch information
1 parent
20f0cfa
commit 9f908b7
Showing
368 changed files
with
51,375 additions
and
57,401 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
name: Taier Web CI | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
paths: | ||
- "taier-ui/**" | ||
pull_request: | ||
branches: | ||
- master | ||
paths: | ||
- "taier-ui/**" | ||
|
||
jobs: | ||
build: | ||
runs-on: ${{ matrix.os }} | ||
env: | ||
working-directory: ./taier-ui | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, windows-latest] | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Use Node.js 16 | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16 | ||
registry-url: "https://registry.npmjs.org/" | ||
|
||
- name: Install pnpm | ||
uses: pnpm/action-setup@v2 | ||
with: | ||
version: 7 | ||
run_install: false | ||
|
||
- name: Get pnpm store directory | ||
id: pnpm-cache | ||
shell: bash | ||
run: | | ||
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT | ||
- uses: actions/cache@v3 | ||
name: Setup pnpm cache | ||
with: | ||
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} | ||
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | ||
restore-keys: | | ||
${{ runner.os }}-pnpm-store- | ||
- name: Install dependencies | ||
working-directory: ${{ env.working-directory }} | ||
run: pwd && pnpm install | ||
|
||
- name: Lint code | ||
working-directory: ${{ env.working-directory }} | ||
run: pnpm lint:es && pnpm lint:css | ||
|
||
- name: Run build | ||
working-directory: ${{ env.working-directory }} | ||
run: pnpm build | ||
|
||
- name: Run tests | ||
working-directory: ${{ env.working-directory }} | ||
run: pnpm test | ||
env: | ||
CI: true | ||
NODE_ENV: test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
module.exports = { | ||
extends: [require.resolve('@umijs/fabric/dist/eslint')], | ||
parserOptions: {}, | ||
rules: { | ||
'no-use-before-define': 'off', | ||
'@typescript-eslint/no-use-before-define': 'off', | ||
'consistent-return': 'off', | ||
'react-hooks/exhaustive-deps': 'off', | ||
}, | ||
extends: [require.resolve('ko-lint-config/.eslintrc')], | ||
parserOptions: {}, | ||
rules: { | ||
// Since there are majority of code have to use the not-null-assertion | ||
'@typescript-eslint/no-non-null-assertion': 'off', | ||
// Turn it to warn temporarily since there are some code have to use this comment to skip ts checker | ||
'@typescript-eslint/ban-ts-comment': 'warn', | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
const fabric = require('@umijs/fabric'); | ||
const prettier = require('ko-lint-config/.prettierrc'); | ||
|
||
module.exports = { | ||
...fabric.prettier, | ||
}; | ||
...prettier, | ||
printWidth: 120, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,15 @@ | ||
module.exports = { | ||
extends: [require.resolve('@umijs/fabric/dist/stylelint')], | ||
rules: { | ||
'at-rule-no-unknown': null, | ||
}, | ||
extends: [require.resolve('ko-lint-config/.stylelintrc')], | ||
rules: { | ||
// Although hexadecimal is traditionally written in uppercase, but we choose lower only because of quicker to read | ||
'color-hex-case': 'lower', | ||
// Prefer more empty line between style because of quicker to read | ||
'rule-empty-line-before': [ | ||
'always', | ||
{ | ||
except: ['after-single-line-comment', 'first-nested'], | ||
}, | ||
], | ||
'custom-property-pattern': '^([a-zA-Z]*)(-[a-zA-Z]+)*$', | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.