-
-
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.
feat: rewrite with new flat ESLint config format (#12)
- Loading branch information
Showing
39 changed files
with
3,036 additions
and
1,855 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
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 was deleted.
Oops, something went wrong.
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,18 @@ | ||
package-lock.json | ||
yarn.lock | ||
pnpm-lock.yaml | ||
|
||
.next | ||
.cache | ||
.DS_Store | ||
.idea | ||
*.log | ||
*.tgz | ||
coverage | ||
dist | ||
lib-cov | ||
logs | ||
node_modules | ||
temp | ||
dist-types | ||
*.tsbuildinfo |
This file was deleted.
Oops, something went wrong.
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,9 +1,77 @@ | ||
# @ocavue/eslint-config | ||
|
||
[![@ocavue/eslint-config](https://img.shields.io/npm/v/@ocavue/eslint-config/latest?label=%40ocavue%2Feslint-config)](https://www.npmjs.com/package/@ocavue/eslint-config) | ||
[![@ocavue/eslint-config-react](https://img.shields.io/npm/v/@ocavue/eslint-config-react/latest?label=%40ocavue%2Feslint-config-react)](https://www.npmjs.com/package/@ocavue/eslint-config-react) | ||
A set of ESLint shareable configs for TypeScript projects. | ||
|
||
- Out of the box support for TypeScript, React, and Markdown | ||
- Sort your imports | ||
- Sort your fields in `package.json` | ||
|
||
## License | ||
## Install | ||
|
||
MIT | ||
``` | ||
$ npm install -D eslint prettier @ocavue/eslint-config | ||
``` | ||
|
||
## Usage | ||
|
||
### Config ESLint | ||
|
||
You will need to use the new ["flat" ESLint configuration](https://eslint.org/docs/latest/use/configure/configuration-files-new) (i.e. `eslint.config.js`). | ||
|
||
In your `eslint.config.js` file, add the following to extend the basic config: | ||
|
||
```JS | ||
// eslint.config.js | ||
import { basic } from '@ocavue/eslint-config' | ||
|
||
export default [...basic()] | ||
``` | ||
|
||
If you want to use the React config, you can do the following: | ||
|
||
```JS | ||
// eslint.config.js | ||
import { basic, react } from '@ocavue/eslint-config' | ||
|
||
export default [...basic(), ...react()] | ||
``` | ||
|
||
If you want to use the check the code blocks in markdown files, you can do the following: | ||
|
||
```JS | ||
// eslint.config.js | ||
import { basic, markdown } from '@ocavue/eslint-config' | ||
|
||
export default [...basic(), ...markdown()] | ||
``` | ||
|
||
### Add script for package.json | ||
|
||
```json | ||
{ | ||
"scripts": { | ||
"lint": "eslint .", | ||
"check": "prettier --check .", | ||
"fix": "eslint --fix . && prettier --write ." | ||
} | ||
} | ||
``` | ||
|
||
### Add `.prettierignore` | ||
|
||
Add a [`.prettierignore`](https://prettier.io/docs/en/ignore.html#ignoring-files-prettierignore) file in the root of your project. You can copy the `.prettierignore` file from this project. | ||
|
||
### VS Code integration | ||
|
||
If you are using VS Code, you and install [ESLint extension](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) and [Prettier extension](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode), then add the following to your VS Code settings: | ||
|
||
```json | ||
// .vscode/settings.json | ||
{ | ||
"editor.defaultFormatter": "esbenp.prettier-vscode", | ||
"editor.formatOnSave": true, | ||
"editor.codeActionsOnSave": { | ||
"source.fixAll.eslint": true | ||
} | ||
} | ||
``` |
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,5 @@ | ||
import { defineFlatConfig } from 'eslint-define-config' | ||
|
||
import { basic } from './index.js' | ||
|
||
export default defineFlatConfig(basic()) |
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,5 @@ | ||
export * from './src/typescript.js' | ||
export * from './src/prettier.js' | ||
export * from './src/basic.js' | ||
export * from './src/markdown.js' | ||
export * from './src/react.js' |
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 was deleted.
Oops, something went wrong.
Oops, something went wrong.