Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ilyasemenov/lint-config
Eslint and Stylelint configs to use in projects that I develop or supervise.
https://github.com/ilyasemenov/lint-config
Last synced: 11 days ago
JSON representation
Eslint and Stylelint configs to use in projects that I develop or supervise.
- Host: GitHub
- URL: https://github.com/ilyasemenov/lint-config
- Owner: IlyaSemenov
- License: mit
- Created: 2024-09-07T15:46:10.000Z (2 months ago)
- Default Branch: main
- Last Pushed: 2024-10-25T09:37:03.000Z (23 days ago)
- Last Synced: 2024-10-25T16:51:55.221Z (23 days ago)
- Language: TypeScript
- Homepage:
- Size: 108 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# @ilyasemenov/lint-config
A set of reusable linter configs that I use in the projects that I develop or supervise:
- for `eslint`, extends [@antfu/eslint-config](https://github.com/antfu/eslint-config).
- for `stylelint`## Install
```sh
pnpm add -D @ilyasemenov/lint-config eslint stylelint
```## Setup eslint
Create `eslint.config.js`:
```js
import { defineEslintConfig } from "@ilyasemenov/lint-config"export default defineEslintConfig()
```Available options:
```js
export default defineEslintConfig({
// Lint Vue. Unlike antfu, must be enabled explicitly.
vue: true,// Lint pug in Vue templates.
vuePug: true,// ...and all @antfu/eslint-config options.
})
```## Setup stylelint
Create `stylelint.config.js`:
```js
import { defineStylelintConfig } from "@ilyasemenov/lint-config"export default defineStylelintConfig()
```Available options:
```js
export default defineStylelintConfig({
// Use tabs for indentation.
tabs: true,// Use single quotes.
quotes: "single",// ...and all stylelint options.
})
```## Add command line script
Add to `package.json`:
```json
{
"scripts": {
"lint": "eslint --fix . && stylelint --fix '**/*.{css,scss,vue}'"
}
}
```and run:
```sh
pnpm lint
```## Setup lint-staged
Create `lint-staged.config.js`:
```js
export default {
"*.{cjs,js,ts,json,md,yaml,toml}": "eslint --fix",
"*.{css,scss}": "stylelint --fix",
"*.vue": ["eslint --fix", "stylelint --fix"],
}
```