Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/shlroland/lint-config
a collection for lint config
https://github.com/shlroland/lint-config
eslint husky lint lint-staged prettier
Last synced: 2 months ago
JSON representation
a collection for lint config
- Host: GitHub
- URL: https://github.com/shlroland/lint-config
- Owner: shlroland
- License: mit
- Created: 2022-02-28T14:46:32.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2024-10-18T23:02:17.000Z (3 months ago)
- Last Synced: 2024-10-19T05:45:02.721Z (3 months ago)
- Topics: eslint, husky, lint, lint-staged, prettier
- Language: TypeScript
- Homepage:
- Size: 46.7 MB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# @shlroland/lint-config
## setting lint config will be easy and fast
a collection of
- eslint
- cz(czg) + commitlint
- lint-staged
- husky
- prettier## Usage
### Wizard Setup
execute the following command in your terminal, the lint tools will be installed and configured automatically.
```bash
pnpm dlx @shlroland/lint-cli
```#### parameters
- `None` : no parameters means default lint tools will be installed and configured automatically.
- `-I`: select lint tools interactively instead of using default settings automatically.
- `install` : only install lint tools.
- `-I`: install lint tools interactively.
- `config` : only config lint tools.
- `-I`: config lint tools interactively.
- `-f`: skip all prompts and override the existing configuration.> [!IMPORTANT]
> Wizard Setup only install default lint tools and configure them according to the default settings.
> After executing the completion command, adjustments may need to be made according to project requirements### Manual Setup
#### eslint
`@shlroland/eslint-config` is based on [`@antfu/eslint-config`][antfu-eslint-config] and extends some rules.
##### install
```bash
pnpm add -D eslint @shlroland/eslint-config eslint-plugin-format
```##### config
create `eslint.config.js`
```js
// for "type": "module"
import { shlroland } from '@shlroland/eslint-config'
export default shlroland()
``````js
// for "type": "commonjs"
const { shlroland } = require('@shlroland/eslint-config')
module.exports = shlroland()
```#### cz(czg) + commitlint
use [`czg`](https://cz-git.qbb.sh/) to generate commit messages. And use [`commitlint`](https://commitlint.js.org/) to lint commit messages.
##### install
```bash
pnpm add -D @commitlint/cli czg @shlroland/cz-config
```##### config
create `commitlint.config.js`
```js
// for "type": "module"
import { config } from '@shlroland/cz-config/commitlint'
export default config// for "type": "commonjs"
module.exports = require('@shlroland/cz-config')
```#### lint-staged
##### install
```bash
pnpm add -D lint-staged @shlroland/lint-staged
```##### config
create `lint-staged.config.js`
```js
// for "type": "module"
import config from '@shlroland/lint-staged'
export default config// for "type": "commonjs"
module.exports = require('@shlroland/lint-staged')
```### husky
#### config
follow the [husky](https://typicode.github.io/husky/) official documentation to config.
And copy the husky config from [`@shlroland/husky-config`](./packages/husky/index.ts) to your project.#### prettier(not recommended)
> it is not recommended use `prettier` to format code, since following the philosophy of [`@antfu/eslint-config`][antfu-eslint-config].
##### install
```bash
pnpm add -D prettier @shlroland/prettier-config
```##### config
create `prettier.config.js`
```js
// for "type": "module"
import config from '@shlroland/prettier-config'
export default config// for "type": "commonjs"
module.exports = require('@shlroland/prettier-config')
```Inspired by
- [@c4605/toolconfs](https://www.npmjs.com/package/@c4605/toolconfs)
- [@antfu/eslint-config](https://github.com/antfu/eslint-config)
- [@fantasticit/code-lint](https://github.com/fantasticit/code-lint)[antfu-eslint-config]: https://github.com/antfu/eslint-config