Skip to content

Commit

Permalink
v2.0.5 - Update docs and dependencies (#14)
Browse files Browse the repository at this point in the history
* update docs & pkg json

* update flat-config dependencies

* test jsx-a11y, update docs

* update typescript-eslint, rm @eslint/compat

* update eslint-config libs, update v2 changelog

* update docs & eslint version

* re-enable @stylistic/indent & update readme

* update readme

* update readme
  • Loading branch information
nishkohli96 authored Aug 8, 2024
1 parent 7b16bef commit c7969a2
Show file tree
Hide file tree
Showing 26 changed files with 2,438 additions and 3,991 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@

Compatible with eslint `v8` and `v9`!

This monorepo contains the source code for [@nish1896/eslint-config](https://www.npmjs.com/package/@nish1896/eslint-config), [@nish1896/eslint-flat-config](https://www.npmjs.com/package/@nish1896/eslint-flat-config) as well as the common [docs 📖](https://nish1896-eslint-config.vercel.app/) shared by these two packages, made using [Docusaurus](https://docusaurus.io/). Also included is a couple of apps with dummy test code to experiment with new and existing rules.
This monorepo contains the source code for [@nish1896/eslint-config](https://www.npmjs.com/package/@nish1896/eslint-config), [@nish1896/eslint-flat-config](https://www.npmjs.com/package/@nish1896/eslint-flat-config) as well as the common [docs](https://nish1896-eslint-config.vercel.app/) 📖 shared by these two packages. Also included are a couple of apps with dummy js code to experiment with new and existing rules.
2 changes: 1 addition & 1 deletion apps/docs/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# @nish1896/eslint-config-docs

This website is built using [Docusaurus](https://docusaurus.io/), a modern static website generator.
Documentation for [@nish1896/eslint-config](https://www.npmjs.com/package/@nish1896/eslint-config) & [@nish1896/eslint-flat-config](https://www.npmjs.com/package/@nish1896/eslint-flat-config) built using [Docusaurus](https://docusaurus.io/).

[https://nish1896-eslint-config.vercel.app/](https://nish1896-eslint-config.vercel.app/)
28 changes: 25 additions & 3 deletions apps/docs/docs/changelog/v2.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,29 @@ title: Changelog-v2

# **What's changed?**

## [2.0.3](https://github.com/nishkohli96/eslint-config/tree/v2.0.3)
## [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**

Expand Down Expand Up @@ -44,9 +66,9 @@ coding practice. Reasons for removing rules can be found [here](../rules-removed
[@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](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`
[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)

Expand Down
17 changes: 9 additions & 8 deletions apps/docs/docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ 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 the [migration guide](./migration/v1_to_v2.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.

Expand Down Expand Up @@ -71,13 +73,12 @@ yarn run eslint yourfile.js
```
:::info
This config extends the following plugins and parsers -
- [eslint/recommended](https://www.npmjs.com/package/eslint) - 9.3.0 & 8.57.0
- [eslint-plugin-react](https://www.npmjs.com/package/eslint-plugin-react) - 7.34.1
- [eslint-plugin-react-hooks](https://www.npmjs.com/package/eslint-plugin-react-hooks) - 4.6.0
- [eslint-plugin-jsx-a11y](https://www.npmjs.com/package/eslint-plugin-jsx-a11y) - 6.8.0
- [@stylistic/eslint-plugin](https://www.npmjs.com/package/@stylistic/eslint-plugin) - 2.1.0 & 1.7.0
- [@typescript-eslint/eslint-plugin](https://www.npmjs.com/package/@typescript-eslint/eslint-plugin) - 7.9.0
- [@typescript-eslint/parser](https://www.npmjs.com/package/@typescript-eslint/parser) - 7.9.0
- [eslint](https://www.npmjs.com/package/eslint) - 9.8.0 & 8.57.0
- [eslint-plugin-react](https://www.npmjs.com/package/eslint-plugin-react) - 7.35.0
- [eslint-plugin-react-hooks](https://www.npmjs.com/package/eslint-plugin-react-hooks) - 4.6.2
- [eslint-plugin-jsx-a11y](https://www.npmjs.com/package/eslint-plugin-jsx-a11y) - 6.9.0
- [@stylistic/eslint-plugin](https://www.npmjs.com/package/@stylistic/eslint-plugin) - 2.6.1
- [typescript-eslint](https://www.npmjs.com/package/typescript-eslint) - 8.0.1
:::

**You may also choose to install other eslint plugins or configurations depending upon your application needs.**
Expand Down
2 changes: 1 addition & 1 deletion apps/docs/docs/intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ title: Introduction
![NPM Version](https://img.shields.io/npm/v/%40nish1896%2Feslint-flat-config)
![NPM Downloads](https://img.shields.io/npm/dt/%40nish1896%2Feslint-flat-config)
![node-current](https://img.shields.io/node/v/%40nish1896%2Feslint-flat-config?color=%23e86267)
![GitHub Release Date - Published_At](https://img.shields.io/github/release-date/nishkohli96/eslint-flat-config)


**A set of developer-friendly [eslint](https://eslint.org/), [stylistic](https://eslint.style/), [typescript](https://www.typescriptlang.org/) and [accessibility](https://developer.mozilla.org/en-US/docs/Learn/Accessibility/What_is_accessibility) configuration rules to help you and fellow developers follow the industry-recommended coding practices for easier readability, maintenance and productivity !**

Expand Down
2 changes: 1 addition & 1 deletion apps/docs/docs/migration/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@

Due to eslint v9, the which introduced a flat-config file, another package had to be created with same set of rules to make this repository one of the earliest eslint shareable configs to be compatible with the flat file structure.

- If you are using eslint version ***8.56 or below***, use [@nish1896/eslint-config](https://www.npmjs.com/package/@nish1896/eslint-config).
- If you are using eslint version ***8.57.0 or below***, use [@nish1896/eslint-config](https://www.npmjs.com/package/@nish1896/eslint-config).

- For eslint version ***9 and above***, use [@nish1896/eslint-flat-config](https://www.npmjs.com/package/@nish1896/eslint-flat-config).
2 changes: 1 addition & 1 deletion apps/docs/docs/migration/v1_to_v2.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ description: Migration guide from v1 to v2 for this eslint-config.

For usage in a nodejs application, use only the `js` eslint configuration of this package.

```
```diff
module.exports = {
- extends: ['@nish1896']
+ extends: ['@nish1896/eslint-config/js']
Expand Down
2 changes: 1 addition & 1 deletion apps/docs/docs/rules-removed.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ title: Rules Removed

# **Rules Removed**

These rules were once included, but later removed in subsequent versions due to their inconsistency in certain scenarios after trying out in various node and react projects. You will need to manually add them in the `rules` of your .eslintrc, if needed.
These rules were once included, but later removed in subsequent versions due to their inconsistency in certain scenarios after trying out in various node and react projects. You will need to manually add them in the `rules` of your eslint config file, if needed.

| Rule Name | Reason |
|-|-|
Expand Down
2 changes: 1 addition & 1 deletion apps/docs/docs/rules/eslint.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ title: Eslint Rules

# Eslint

## **Javascript**
## **JS Rules**

|Rule Name|🔧|
|-|-|
Expand Down
6 changes: 1 addition & 5 deletions apps/docs/docs/rules/jsx-a11y.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,11 @@ title: Jsx-A11y Rules

# Jsx-A11y

The below rules are not enabled below by default in the [jsx-a11y/recommended](https://github.com/jsx-eslint/eslint-plugin-jsx-a11y?tab=readme-ov-file#supported-rules) plugin. These rules will throw an error if not enforced.
The below rules are not enabled below by default in the [jsx-a11y/recommended](https://github.com/jsx-eslint/eslint-plugin-jsx-a11y?tab=readme-ov-file#supported-rules) plugin and will throw an error if not enforced.

All rule names start with `jsx-a11y/` prefix.

| Rule Name |
|-|
|[anchor-ambiguous-text](https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/HEAD/docs/rules/anchor-ambiguous-text.md)|
|[control-has-associated-label](https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/HEAD/docs/rules/control-has-associated-label.md)|

:::note
As of June 1, 2024 [jsx-a11y](https://www.npmjs.com/package/eslint-plugin-jsx-a11y) has not been migrated to the flat-file structure. Even the `fixupPluginRules` function from [@eslint/compat](https://eslint.org/blog/2024/05/eslint-compatibility-utilities/#using-the-compatibility-utilities) from doesn't make it work in`@nish1896/eslint-flat-config`. However, it does work in the other package.
:::
4 changes: 2 additions & 2 deletions apps/docs/docs/rules/stylistic.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ title: Stylistic Rules

**All rule names start with `@stylistic/` prefix.**

## **Javascript (js)**
## **JS Rules**

These rules are included in the `@nish1896/eslint-flat-config/js` and `@nish1896/eslint-config/js` import.

Expand Down Expand Up @@ -52,7 +52,7 @@ These rules are included in the `@nish1896/eslint-flat-config/js` and `@nish1896
|[type-named-tuple-spacing](https://eslint.style/rules/default/type-named-tuple-spacing)||
|[wrap-regex](https://eslint.style/rules/default/wrap-regex)||

## **Javascript in React (jsx)**
## **JSX Rules**

These rules are included in the `@nish1896/eslint-flat-config/jsx` and `@nish1896/eslint-config/react` import.

Expand Down
2 changes: 1 addition & 1 deletion apps/docs/docs/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ title: Usage

<!-- In case you are migrating from v1.0.x, check the [Migration Guide](./migration/). -->

- If you are using eslint version ***8.56 or below***, use [@nish1896/eslint-config](https://www.npmjs.com/package/@nish1896/eslint-config).
- If you are using eslint version ***8.57 or below***, use [@nish1896/eslint-config](https://www.npmjs.com/package/@nish1896/eslint-config).
- For eslint version ***9 and above***, use [@nish1896/eslint-flat-config](https://www.npmjs.com/package/@nish1896/eslint-flat-config).

:::info
Expand Down
2 changes: 1 addition & 1 deletion apps/docs/docs/why-eslint.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Besides error catching, eslint rules are also capable of formatting your code wh

However, in this config, we will be mainly using [eslint-stylistic](https://eslint.style/) over [prettier](https://prettier.io/) as it gives you additional options to format your code and hopefully avoid conflict of rules between `eslint` and `prettier` for which you additionally had to install [eslint-config-prettier](https://www.npmjs.com/package/eslint-config-prettier). I still use `prettier`, but to only format non `.js(x)` and `.ts(x)` files like `.html` and `.css`.

On running `eslint .` some of the rules imported from this config will give you a warning ⚠️ indicating that the code issue may be ignored while the rules triggering an error ❌ will discourage you to avoid that coding practice. `eslint --fix .` should hopefully fix most of the warnings or errors in your code. It's okay to have a few warnings when developing, but they should be taken care of when pushing your code for production.
On running `eslint .` some of the rules imported from this config will give you a warning ⚠️ indicating that the code issue may be ignored while the rules triggering an error ❌ will discourage you to avoid that coding practice. The `eslint --fix` command should hopefully fix most of the warnings or errors in your code. It's okay to have a few warnings when developing, but they should be taken care of when pushing your code for production.

:::warning
Ignored eslint warnings or errors in code will likely cause your app build to fail, unless resolved or specified eslint to ignore using the `eslint-ignore` syntax.
Expand Down
5 changes: 2 additions & 3 deletions apps/test-code-eslint-v8/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@

This repo uses `eslint@8.57.0` & `@nish1896/eslint-config`.

Write the worst possible 🗑️ code in this folder and then run
Write the worst possible 🗑️ code in this folder and then run the below command to see your console full of warnings ⚠️ and errors ❌.
```
npm run lint
```
to see your console full of warnings ⚠️ and errors ❌. You can run

You can run the below command to allow eslint to fix as many errors as possible.
```
npm run fix
```
command to allow eslint to fix as many errors as possible.
5 changes: 2 additions & 3 deletions apps/test-code-eslint-v9/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@

This repo uses `eslint 9` & `@nish1896/eslint-flat-config`.

Write the worst possible 🗑️ code in this folder and then run
Write the worst possible 🗑️ code in this folder and then run the below command to see your console full of warnings ⚠️ and errors ❌.
```
npm run lint
```
to see your console full of warnings ⚠️ and errors ❌. You can run

You can run the below command to allow eslint to fix as many errors as possible.
```
npm run fix
```
command to allow eslint to fix as many errors as possible.
4 changes: 2 additions & 2 deletions apps/test-code-eslint-v9/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
"url": "git+https://github.com/nishkohli96/eslint-config.git"
},
"devDependencies": {
"@eslint/js": "^9.3.0",
"@eslint/js": "^9.8.0",
"@nish1896/eslint-flat-config": "*",
"eslint": "^9.3.0"
"eslint": "^9.8.0"
},
"engines": {
"node": ">=14"
Expand Down
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nish1896/eslint-config-root",
"version": "1.0.0",
"version": "1.0.1",
"description": "eslint and stylistic rules to help you focus more on the code logic, while they take care of the code formatting",
"author": "Nishant Kohli",
"private": true,
Expand All @@ -10,7 +10,9 @@
"link:local": "yarn workspace @nish1896/eslint-config link:local",
"unlink:local": "npm unlink @nish1896/eslint-config",
"docs": "yarn workspace @nish1896/eslint-config-docs start",
"docs:build": "yarn workspace @nish1896/eslint-config-docs build"
"docs:build": "yarn workspace @nish1896/eslint-config-docs build",
"lint:8": "yarn workspace @nish1896/eslint-config-test-v8 fix",
"lint:9": "yarn workspace @nish1896/eslint-config-test-v9 fix"
},
"keywords": [
"@nish1896",
Expand Down
3 changes: 2 additions & 1 deletion packages/eslint-config/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@
> [!NOTE]
>This package is compatible with eslint `8.57.0` or below. For eslint `9.0.0` or above check [@nish1896/eslint-flat-config](https://www.npmjs.com/package/@nish1896/eslint-flat-config).
<p style={{ fontSize: '20px', fontWeight: 500 }}>For detailed information about this config, please read the [docs](https://nish1896-eslint-config.vercel.app/)</p>
For detailed information, please read the [docs](https://nish1896-eslint-config.vercel.app/).

24 changes: 12 additions & 12 deletions packages/eslint-config/lib/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,18 @@ module.exports = {
'@stylistic/eol-last': 'warn',
'@stylistic/function-call-argument-newline': ['warn', 'consistent'],
'@stylistic/function-paren-newline': ['warn', 'consistent'],
// '@stylistic/indent': [
// 'warn',
// 2,
// {
// ignoredNodes: [
// 'PropertyDefinition[decorators]',
// 'MethodDefinition[decorators]',
// 'ClassBody.body > Decorator'
// ],
// SwitchCase: 1
// }
// ],
'@stylistic/indent': [
'warn',
2,
{
ignoredNodes: [
'PropertyDefinition[decorators]',
'MethodDefinition[decorators]',
'ClassBody.body > Decorator'
],
SwitchCase: 1
}
],
'@stylistic/indent-binary-ops': ['warn', 2],
'@stylistic/key-spacing': 'warn',
'@stylistic/linebreak-style': 'warn',
Expand Down
18 changes: 9 additions & 9 deletions packages/eslint-config/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@nish1896/eslint-config",
"version": "2.0.3",
"description": "eslint and stylistic rules for eslint 8.57.0 or below to help you focus more on the code logic, while they take care of the code formatting",
"version": "2.0.5",
"description": "eslint and stylistic rules for eslint 8.57.0 or below to take care of the code formatting.",
"author": "Nishant Kohli",
"exports": {
"./js": "./lib/js/index.js",
Expand Down Expand Up @@ -32,19 +32,19 @@
"url": "git+https://github.com/nishkohli96/eslint-config.git"
},
"dependencies": {
"@stylistic/eslint-plugin": "^1.7.0",
"@typescript-eslint/eslint-plugin": "^7.11.0",
"@typescript-eslint/parser": "^7.11.0",
"eslint-plugin-jsx-a11y": "^6.8.0",
"eslint-plugin-react": "^7.34.2",
"@stylistic/eslint-plugin": "^2.6.1",
"@typescript-eslint/eslint-plugin": "^8.0.1",
"@typescript-eslint/parser": "^8.0.1",
"eslint-plugin-jsx-a11y": "^6.9.0",
"eslint-plugin-react": "^7.35.0",
"eslint-plugin-react-hooks": "^4.6.2",
"typescript-eslint": "^7.11.0"
"typescript-eslint": "^8.0.1"
},
"engines": {
"node": ">=14"
},
"peerDependencies": {
"eslint": ">=7",
"eslint": ">=7 <9",
"typescript": ">=4"
},
"license": "ISC"
Expand Down
5 changes: 3 additions & 2 deletions packages/eslint-flat-config/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
![NPM Version](https://img.shields.io/npm/v/%40nish1896%2Feslint-flat-config)
![NPM Downloads](https://img.shields.io/npm/dt/%40nish1896%2Feslint-flat-config)
![node-current](https://img.shields.io/node/v/%40nish1896%2Feslint-flat-config?color=%23e86267)
![GitHub Release Date - Published_At](https://img.shields.io/github/release-date/nishkohli96/eslint-flat-config)
![GitHub Release Date - Published_At](https://img.shields.io/github/release-date/nishkohli96/eslint-config)

**A set of developer-friendly [eslint](https://eslint.org/), [stylistic](https://eslint.style/), [typescript](https://www.typescriptlang.org/) and [accessibility](https://developer.mozilla.org/en-US/docs/Learn/Accessibility/What_is_accessibility) configuration rules to help you and fellow developers follow the industry-recommended coding practices for easier readability, maintenance and productivity !**

> [!NOTE]
>This package is compatible with eslint `9.0.0` or above. For eslint `8.57.0` or below check [@nish1896/eslint-config](https://www.npmjs.com/package/@nish1896/eslint-config).
<p style={{ fontSize: '20px', fontWeight: 500 }}>For detailed information about this config, please read the [docs](https://nish1896-eslint-config.vercel.app/)</p>
For detailed information, please read the [docs](https://nish1896-eslint-config.vercel.app/).

24 changes: 12 additions & 12 deletions packages/eslint-flat-config/lib/js/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,18 @@ export default [
'@stylistic/eol-last': 'warn',
'@stylistic/function-call-argument-newline': ['warn', 'consistent'],
'@stylistic/function-paren-newline': ['warn', 'consistent'],
// '@stylistic/indent': [
// 'warn',
// 2,
// {
// ignoredNodes: [
// 'PropertyDefinition[decorators]',
// 'MethodDefinition[decorators]',
// 'ClassBody.body > Decorator'
// ],
// SwitchCase: 1
// }
// ],
'@stylistic/indent': [
'warn',
2,
{
ignoredNodes: [
'PropertyDefinition[decorators]',
'MethodDefinition[decorators]',
'ClassBody.body > Decorator'
],
SwitchCase: 1
}
],
'@stylistic/indent-binary-ops': ['warn', 2],
'@stylistic/key-spacing': 'warn',
'@stylistic/linebreak-style': 'warn',
Expand Down
Loading

0 comments on commit c7969a2

Please sign in to comment.