-
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.
v2.1.0 - Add NextJS Config, version docs, add example apps (#15)
* up version number of packages * version docs, rename docs app to eslint-config-docs * add nextjs apps, and eslint-config/next * rm next-app-eslint9 * add downloads per month * add downloads per month in intro page * update pkgs and prepare v2.1 changelog * add react-app for eslint-flat-config * add & test flat-config in react app * docs updating wip * add vite * test code in examples * updte docs wip * update docs, changelog and readme * update package.json * upgrade docusaurus * update github action and publish scripts * tag v 2.1 in docs * update github actions
- Loading branch information
1 parent
c7969a2
commit a8d1764
Showing
144 changed files
with
9,178 additions
and
1,737 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,23 @@ | ||
name: Build Docs | ||
|
||
on: push | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
id-token: write | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Setup Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: '20.10.0' | ||
registry-url: 'https://registry.npmjs.org' | ||
|
||
- name: Install Dependencies | ||
run: yarn install --frozen-lockfile | ||
|
||
- name: Build Docs | ||
run: yarn docs:build |
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,31 +1,30 @@ | ||
name: Node.js CI | ||
name: Publish Packages on NPM | ||
|
||
on: | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
check: | ||
name: Prepare release... | ||
build: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
id-token: write | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Setup Node.js | ||
# Setup .npmrc file to publish to npm | ||
uses: actions/setup-node@v3 | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: '20.10.0' | ||
registry-url: 'https://registry.npmjs.org' | ||
|
||
- name: Install Dependencies | ||
run: yarn --frozen-lockfile | ||
|
||
|
||
- name: release @nish1896/eslint-config | ||
run: yarn workspace @nish1896/eslint-config publish:manual | ||
run: yarn workspace @nish1896/eslint-config publish:ci | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
|
||
- name: release @nish1896/eslint-flat-config | ||
run: yarn workspace @nish1896/eslint-flat-config publish:manual | ||
run: yarn workspace @nish1896/eslint-flat-config publish:ci | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
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,2 +1,4 @@ | ||
node_modules | ||
.DS_Store | ||
.DS_Store | ||
|
||
publish.sh |
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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,47 @@ | ||
--- | ||
sidebar_position: 3 | ||
sidebar_label: v1 | ||
description: Changelog and release dates for v1 of this eslint-config. | ||
title: Changelog-v1 | ||
--- | ||
|
||
# **What's changed ?** | ||
|
||
## [1.0.4](https://github.com/nishkohli96/eslint-config/tree/v1.0.4) | ||
|
||
**Released - 12 Feb, 2024** | ||
|
||
- Upgraded `@stylistic/eslint-plugin`, `@typescript-eslint/eslint-plugin` and `@typescript-eslint/parser` dependencies. | ||
- Removed `es2024` key from `env`. | ||
- Turn off [no-mixed-spaces-and-tabs](https://eslint.style/rules/default/no-mixed-spaces-and-tabs) rule. | ||
|
||
## [1.0.3](https://github.com/nishkohli96/eslint-config/tree/v1.0.3) | ||
|
||
**Released - 31 Jan, 2024** | ||
|
||
"*More developer friendly, Yay*! 😃" | ||
|
||
Approx 90% of the rules used now `warn` instead of throwing an error, so you can focus more on writing the logic, and not on formatting the code! Only the rules that throw an `error` and some exceptional `warn` rules like `'no-debugger'` must be fixed by the developer. | ||
|
||
Also, added some cool new badges in **README.md** thanks to [Shields.io](https://shields.io/) ! | ||
|
||
## [1.0.2](https://github.com/nishkohli96/eslint-config/tree/v1.0.2) | ||
|
||
**Released - 28 Jan, 2024** | ||
|
||
While using this package during my development, I felt that the status of the rules listed below needed to be changed from `error` to `warn` as they would cause my app to crash, prompting me to alter my code to keep eslint happy (and make me irritated instead 😡). These rules would automatically fix the code on running the `yarn lint` script. | ||
|
||
These rules are listed below - | ||
|
||
| Rule Name | | ||
|-| | ||
|[comma-dangle](https://eslint.style/rules/default/comma-dangle)| | ||
|[ban-ts-comment](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/ban-ts-comment.md)| | ||
|[eol-last](https://eslint.style/rules/default/eol-last)| | ||
|[jsx-one-expression-per-line](https://eslint.style/rules/default/jsx-one-expression-per-line)| | ||
|
||
The below rule is removed from the config file. | ||
|
||
| Rule Name | Reason | | ||
|-|-| | ||
|[multiline-comment-style](https://eslint.org/docs/latest/rules/multiline-comment-style)|the default setting `starred-block` read commented code as a comment itself, which made it difficult to uncomment the code| |
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,106 @@ | ||
--- | ||
sidebar_position: 2 | ||
sidebar_label: v2.0 | ||
description: Changelog and release dates for version 2.0.x of this eslint-config. | ||
title: Changelog-v2.0 | ||
--- | ||
|
||
# **What's changed?** | ||
|
||
## [2.0.5](https://github.com/nishkohli96/eslint-config/tree/v2.0.5) | ||
|
||
**Released - 8 August, 2024** | ||
|
||
- Update docs | ||
- Update [eslint](https://www.npmjs.com/package/eslint) & [@eslint/js](https://www.npmjs.com/package/@eslint/js) in `@nish1896/eslint-config-test-v9`. | ||
- Re-enabled [@stylistic/indent](https://eslint.style/rules/default/indent) rule, since it is now indenting decorators properly in the code. | ||
- Remove [@eslint/compat](https://www.npmjs.com/package/@eslint/compat) since [eslint-plugin-jsx-a11y](https://www.npmjs.com/package/eslint-plugin-jsx-a11y) now supports eslint v9. | ||
|
||
**Upgrade Dependencies** | ||
|
||
| Dependency | Version | | ||
|-|-| | ||
|[@stylistic/eslint-plugin](https://www.npmjs.com/package/@stylistic/eslint-plugin)|`2.1.0` to `2.6.1`| | ||
|[@typescript-eslint/eslint-plugin](https://www.npmjs.com/package/@typescript-eslint/eslint-plugin)|`7.11.0` to `8.1.0`| | ||
|[@typescript-eslint/parser](https://www.npmjs.com/package/@typescript-eslint/parser)|`7.11.0` to `8.1.0`| | ||
|[eslint](https://www.npmjs.com/package/eslint)|`9.3.0` to `9.8.0`| | ||
|[eslint-plugin-jsx-a11y](https://www.npmjs.com/package/eslint-plugin-jsx-a11y)|`6.8.0` to `6.9.0`| | ||
|[eslint-plugin-react](https://www.npmjs.com/package/eslint-plugin-react)|`7.34.2` to `7.35.0`| | ||
|[globals](https://www.npmjs.com/package/globals)|`15.2.0` to `15.9.0`| | ||
|[typescript-eslint](https://www.npmjs.com/package/typescript-eslint)|`7.11.0` to `8.1.0`| | ||
|
||
## [2.0.4](https://github.com/nishkohli96/eslint-config/tree/v2.0.3) | ||
|
||
**Released - 3 June, 2024** | ||
|
||
<p style={{ fontSize: "25px" }}>Official [Docs 📖](https://nish1896-eslint-config.vercel.app/) for the config 🎉</p> | ||
|
||
**Rules Modified** | ||
|
||
| Rule Name | Change | | ||
|-|-| | ||
|[require-await](https://eslint.org/docs/latest/rules/require-await) | changed to `warn` | | ||
|[@stylistic/object-curly-newline](https://eslint.style/rules/default/object-curly-newline)| `multiline` -> `consistent` | | ||
|
||
**Rules Disabled** - [@stylistic/indent](https://eslint.style/rules/default/indent) (indenting variable when used with a decorator in typescript, which shouldn't happen) | ||
|
||
**Rules Removed** | ||
|
||
A fair amount of rules have been removed to make linting less frustrating for the developer by preserving his logic and preferred | ||
coding practice. Reasons for removing rules can be found [here](../rules-removed.md). | ||
|
||
| Rule Name | | ||
|-| | ||
|[@stylistic/array-bracket-newline](https://eslint.style/rules/default/array-bracket-newline)| | ||
|[@stylistic/array-element-newline](https://eslint.style/rules/default/array-element-newline)| | ||
|[@stylistic/comma-dangle](https://eslint.style/rules/default/comma-dangle) | | ||
|[@stylistic/no-mixed-operators](https://eslint.style/rules/default/no-mixed-operators)| | ||
|[@stylistic/object-property-newline](https://eslint.style/rules/default/object-property-newline)| | ||
|[arrow-body-style](https://eslint.org/docs/latest/rules/arrow-body-style)| | ||
|[dot-notation](https://eslint.org/docs/latest/rules/dot-notation)| | ||
|
||
**Upgrade Dependencies** | ||
|
||
| Dependency | Version | | ||
|-|-| | ||
[@typescript-eslint/eslint-plugin](https://www.npmjs.com/package/@typescript-eslint/eslint-plugin) |`7.0.0` to `7.9.0`| | ||
[@typescript-eslint/parser](https://www.npmjs.com/package/@typescript-eslint/parser) |`7.6.0` to `7.9.0`| | ||
[eslint](https://www.npmjs.com/package/eslint) | `9.3.0` | | ||
[eslint-plugin-react](https://www.npmjs.com/package/eslint-plugin-react) |`3.4.1` to `3.4.2`| | ||
[eslint-plugin-react-hooks](https://www.npmjs.com/package/eslint-plugin-react-hooks) |`4.6.0` to `4.6.2`| | ||
[typescript-eslint](https://www.npmjs.com/package/typescript-eslint) |`7.9.0` to `7.11.0` | ||
|
||
## [2.0.2](https://github.com/nishkohli96/eslint-config/tree/v2.0.2) | ||
|
||
**Released - 12 Apr, 2024** | ||
|
||
Modify [space-before-blocks](https://eslint.style/rules/default/space-before-blocks) and [comma-dangle](https://eslint.style/rules/default/comma-dangle) config. | ||
|
||
Set keyword spacing to `keywords: 'always'`. Previous config was resulting in no spacing something like, | ||
|
||
``` | ||
if(){} | ||
catch{ | ||
``` | ||
Remove comma dangle from arrays and objects, as traling commas were creating unnecessary noise esp in sequelize queries. | ||
|
||
|
||
## [2.0.1](https://github.com/nishkohli96/eslint-config/tree/v2.0.1) | ||
|
||
**Released - 11 Apr, 2024** | ||
|
||
- Add the following rules in `js` config | ||
- [@typescript-eslint/no-explicit-any](https://typescript-eslint.io/rules/no-explicit-any/) | ||
- [array-element-newline](https://eslint.style/rules/default/array-element-newline) | ||
- [newline-per-chained-call](https://eslint.style/rules/default/newline-per-chained-call) | ||
- [space-before-blocks](https://eslint.style/rules/default/space-before-blocks) | ||
- [space-infix-ops](https://eslint.style/rules/default/space-infix-ops) | ||
- Modify [comma-dangle](https://eslint.style/rules/default/comma-dangle) config. | ||
|
||
## [2.0.0](https://github.com/nishkohli96/eslint-config/tree/v2.0.0) | ||
|
||
**Released - 10 Apr, 2024** | ||
|
||
- Split `js` and `react-jsx` rules | ||
- Turn off [@typescript-eslint/ban-ts-comment](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/ban-ts-comment.mdx) | ||
- Upgraded `@stylistic/eslint-plugin`, `@typescript-eslint/eslint-plugin`, `@typescript-eslint/parser` and `eslint-plugin-react` dependencies. |
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,32 @@ | ||
--- | ||
sidebar_position: 1 | ||
sidebar_label: v2.1 | ||
description: Changelog and release dates for version 2.1.x of this eslint-config. | ||
title: Changelog-v2.1 | ||
--- | ||
|
||
# **What's changed?** | ||
|
||
## [2.1.0](https://github.com/nishkohli96/eslint-config/tree/v2.1.0) | ||
|
||
**Released - 20 October, 2024** | ||
|
||
- Add `next` import for [@nish1896/eslint-config](https://www.npmjs.com/package/@nish1896/eslint-config). | ||
- Add **Downloads Per Month** badge for packages in README. | ||
- Versioning of the documentation 📖. | ||
- Add examples for `react`, `next` and `vite` applications. | ||
|
||
**Upgrade Dependencies** | ||
|
||
| Dependency | Version | | ||
|-|-| | ||
|[@stylistic/eslint-plugin](https://www.npmjs.com/package/@stylistic/eslint-plugin)|`2.6.1` to `2.9.0`| | ||
|[@typescript-eslint/eslint-plugin](https://www.npmjs.com/package/@typescript-eslint/eslint-plugin)|`8.1.0` to `8.10.0`| | ||
|[@typescript-eslint/parser](https://www.npmjs.com/package/@typescript-eslint/parser)|`8.1.0` to `8.10.0`| | ||
|[docusaurus](https://docusaurus.io/)|`3.4.0` to `3.5.2`| | ||
|[eslint](https://www.npmjs.com/package/eslint) and [@eslint/js](https://www.npmjs.com/package/@eslint/js)|`9.8.0` to `9.13.0`| | ||
|[eslint-plugin-jsx-a11y](https://www.npmjs.com/package/eslint-plugin-jsx-a11y)|`6.9.0` to `6.10.0`| | ||
|[eslint-plugin-react](https://www.npmjs.com/package/eslint-plugin-react)|`7.35.0` to `7.37.1`| | ||
|[eslint-plugin-react-hooks](https://www.npmjs.com/package/eslint-plugin-react-hooks)|`4.6.2` to `5.0.0`| | ||
|[globals](https://www.npmjs.com/package/globals)|`15.9.0` to `15.11.0`| | ||
|[typescript-eslint](https://www.npmjs.com/package/typescript-eslint)|`8.1.0` to `8.10.0`| |
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,94 @@ | ||
--- | ||
sidebar_position: 3 | ||
sidebar_label: Installation | ||
description: How to install this package using npm or yarn? | ||
title: Installation | ||
--- | ||
|
||
# Installation | ||
|
||
:::note | ||
In case you are upgrading to eslint **v9 or above** , please check the [migration guide](./migration/eslint-8_to_9.md). | ||
|
||
If you are using eslint v8 and are migrating from `v1.0.x`, please check [this guide](./migration/v1_to_v2.md). | ||
::: | ||
|
||
You'll first need to install [ESLint](https://eslint.org/). If you project is a monorepo, consider creating a separate eslint-config for each package. | ||
|
||
Please do refer the official docs to [install eslint](https://eslint.org/docs/latest/use/getting-started) if needed. | ||
|
||
### Eslint 9 and above | ||
|
||
```js | ||
npm i eslint --save-dev | ||
``` | ||
``` | ||
yarn add -D eslint | ||
``` | ||
|
||
Next, install `@nish1896/eslint-flat-config`. | ||
|
||
``` | ||
npm install @nish1896/eslint-flat-config --save-dev | ||
``` | ||
``` | ||
yarn add -D @nish1896/eslint-flat-config | ||
``` | ||
|
||
### Eslint 8 | ||
|
||
We will be installing **v8.57.0** which was the last major version prior to the release of version 9. | ||
|
||
``` | ||
npm i eslint@8.57.0 --save-dev | ||
``` | ||
``` | ||
yarn add -D eslint@8.57.0 | ||
``` | ||
|
||
Next, install `@nish1896/eslint-config`. | ||
|
||
``` | ||
npm install @nish1896/eslint-config --save-dev | ||
``` | ||
``` | ||
yarn add -D @nish1896/eslint-config | ||
``` | ||
|
||
### Setup | ||
|
||
Paste the following scripts in your `package.json` file | ||
|
||
``` | ||
"lint": "eslint", | ||
"lint:fix": "eslint --fix" | ||
``` | ||
|
||
The first script will check for lint warnings in your code while the second script will format code as per the rules specified in the eslint configuration of your application. The remaining warnings or errors need to be manually fixed by the developer. | ||
|
||
:::tip | ||
You can also add *"lint"* command to your `package.json` file through command line. | ||
|
||
``` | ||
npm pkg set scripts.lint="eslint --fix ." | ||
``` | ||
::: | ||
|
||
After that, you can run ESLint on any file or directory like this: | ||
|
||
``` | ||
npx eslint yourfile.js | ||
``` | ||
|
||
``` | ||
yarn run eslint yourfile.js | ||
``` | ||
|
||
:::info | ||
This config extends the following plugins and parsers - | ||
- [@stylistic/eslint-plugin](https://www.npmjs.com/package/@stylistic/eslint-plugin) - 2.9.0 | ||
- [eslint-plugin-react](https://www.npmjs.com/package/eslint-plugin-react) - 7.37.1 | ||
- [eslint-plugin-react-hooks](https://www.npmjs.com/package/eslint-plugin-react-hooks) - 5.0.0 | ||
- [eslint-plugin-jsx-a11y](https://www.npmjs.com/package/eslint-plugin-jsx-a11y) - 6.10.0 | ||
- [typescript-eslint](https://www.npmjs.com/package/typescript-eslint) - 8.10.0 | ||
::: |
Oops, something went wrong.