-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FR][CPF-91] Setup commit-lint & lint-staged (#92)
* add commit lint * feat: add commit lint config * feat: add commit lint config
- Loading branch information
Showing
6 changed files
with
847 additions
and
42 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
cd frontend | ||
yarn commitlint --edit $1 |
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 |
---|---|---|
|
@@ -2,6 +2,4 @@ | |
|
||
cd frontend | ||
|
||
yarn lint:fix | ||
yarn format | ||
yarn compile | ||
yarn lint-staged |
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,21 @@ | ||
import { ESLint } from 'eslint'; | ||
|
||
const removeIgnoredFiles = async (files) => { | ||
const eslint = new ESLint(); | ||
const isIgnored = await Promise.all( | ||
files.map((file) => { | ||
return eslint.isPathIgnored(file); | ||
}), | ||
); | ||
const filteredFiles = files.filter((_, i) => !isIgnored[i]); | ||
return filteredFiles.join(' '); | ||
}; | ||
|
||
export default { | ||
'./src/**/*.{js,cjs,mjs,jsx,ts,tsx,json,md,yml}': async (files) => { | ||
const match = await removeIgnoredFiles(files); | ||
return [`eslint --max-warnings=0 ${match}`, `prettier --write ${match}`]; | ||
}, | ||
'./**/*.{json,md,yml}': ['prettier --write'], | ||
'package.json': 'npx sort-package-json', | ||
}; |
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 @@ | ||
module.exports = { extends: ['@commitlint/config-conventional'] }; |
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.