Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ufukbakan/eslint-configurer
https://github.com/ufukbakan/eslint-configurer
Last synced: 4 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/ufukbakan/eslint-configurer
- Owner: ufukbakan
- License: mit
- Created: 2023-12-28T15:58:11.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2024-04-03T17:12:41.000Z (9 months ago)
- Last Synced: 2024-12-18T06:24:21.664Z (16 days ago)
- Language: JavaScript
- Size: 10.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# eslint-configurer
This package uses ESLint flat configs
## Installation
```shell
npm i -D eslint-configurer
```
## Usage
```eslint.config.mjs```
```js
import { configure } from "eslint-configurer";export default configure("js", "ts", "react");
```## API
```ts
type Plugin = "js" | "react" | "prettier" | "ts" | "node";function configure(...plugins: Plugin[]): Array>;
```## Recommended Integrations
### .prettierrc
It's recommended to create a .prettierrc configuration file at the source root when using "prettier" preset of this configurer. All configuration file types are supported. A yaml sample provided below:
```.prettierrc.yaml```
```yaml
trailingComma: es5
tabWidth: 4
singleQuote: false
printWidth: 200
endOfLine: crlf
overrides:
- files: "*.{ts,tsx}"
options:
bracketSameLine: true
bracketSpacing: true
cursorOffset: -1
jsxSingleQuote: true
printWidth: 80
semi: true
```### package.json
This section has dependencies to ```husky``` and ```lint-staged```.
The following package.json content is a good practice for linting before committing any file.```json
"scripts": {
"lint": "lint-staged",
"prepare": "husky install && husky add .husky/pre-commit \"npm run lint\""
},
"lint-staged": {
"*.{js,ts,jsx,tsx}": [
"eslint --fix",
"eslint"
]
},
```