Skip to content

Commit

Permalink
v1.0.0 prepare-release (#11)
Browse files Browse the repository at this point in the history
* update project domain url

* rm github pages deploy action

* update docs

* update baseurl for docs

* fix footer links layout

* update logo, favicon & tab title for all pages

* jsx-a11y compatibility fix

* update jsx-a11y doc page

* eslint 8.56.0 -> 8.57.0

* rm comma-dangle

* rm object-curly-newline rule

* reword comma-dangle remove reason

* update README

* upgrade docusarus

* add more test cases

* rm arrow-body-style rule

* rename bad-js.ts to bad-js2.js

* rm dot-notation rule

* modify @stylistic/indent

* rm @stylistic/no-mixed-operators
  • Loading branch information
nishkohli96 committed Jun 2, 2024
1 parent 787685d commit 4057c21
Show file tree
Hide file tree
Showing 44 changed files with 2,086 additions and 773 deletions.
30 changes: 0 additions & 30 deletions .github/workflows/docs.yml

This file was deleted.

52 changes: 26 additions & 26 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
# name: Node.js CI
name: Node.js CI

# on:
# release:
# types: [published]
on:
release:
types: [published]

# jobs:
# check:
# name: Prepare release...
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# - name: Setup Node.js
# # Setup .npmrc file to publish to npm
# uses: actions/setup-node@v3
# with:
# node-version: '20.10.0'
# registry-url: 'https://registry.npmjs.org'
jobs:
check:
name: Prepare release...
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
# Setup .npmrc file to publish to npm
uses: actions/setup-node@v3
with:
node-version: '20.10.0'
registry-url: 'https://registry.npmjs.org'

# - name: Install Dependencies
# run: npm ci
- name: Install Dependencies
run: npm ci

# - name: release @nish1896/eslint-config
# run: yarn workspace @nish1896/eslint-config publish:manual
# env:
# NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: release @nish1896/eslint-config
run: yarn workspace @nish1896/eslint-config publish:manual
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

# - name: release @nish1896/eslint-flat-config
# run: yarn workspace @nish1896/eslint-flat-config publish:manual
# env:
# NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: release @nish1896/eslint-flat-config
run: yarn workspace @nish1896/eslint-flat-config publish:manual
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# @nish1896/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 !**

Compatible with eslint `v8` and `v9`!

To know more, please read the [docs](https://nish1896-eslint-config.vercel.app/)!
38 changes: 1 addition & 37 deletions apps/docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,40 +2,4 @@

This website is built using [Docusaurus](https://docusaurus.io/), a modern static website generator.

### Installation

```
$ yarn
```

### Local Development

```
$ yarn start
```

This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.

### Build

```
$ yarn build
```

This command generates static content into the `build` directory and can be served using any static contents hosting service.

### Deployment

Using SSH:

```
$ USE_SSH=true yarn deploy
```

Not using SSH:

```
$ GIT_USER=<Your GitHub username> yarn deploy
```

If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch.
[https://nish1896-eslint-config.vercel.app/](https://nish1896-eslint-config.vercel.app/)
3 changes: 2 additions & 1 deletion apps/docs/docs/changelog/v1.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
---
sidebar_position: 2
sidebar_label: v1.0.x
sidebar_label: v1
description: Changelog and release dates for v1 of this eslint-config.
title: Changelog-v1
---

# **What's changed ?**
Expand Down
27 changes: 21 additions & 6 deletions apps/docs/docs/changelog/v2.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,40 @@
---
sidebar_position: 1
sidebar_label: v2.0.x
sidebar_label: v2
description: Changelog and release dates for v2 of this eslint-config.
title: Changelog-v2
---

# **What's changed?**

## [2.0.3](https://github.com/nishkohli96/eslint-config/tree/v2.0.3)

**Released - 30 May, 2024**
**Released - 31 May, 2024**

<p style={{ fontSize: "25px" }}>Official Docs 📖 for the config 🎉</p>
<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/array-bracket-newline](https://eslint.style/rules/default/array-bracket-newline)| Moved to 🗑️ |
|[@stylistic/array-element-newline](https://eslint.style/rules/default/array-element-newline)| Moved to 🗑️ |
|[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` |
|[@stylistic/indent](https://eslint.style/rules/default/indent)| add additional option to prevent indentation while using decorators `{ ignoredNodes: ['PropertyDefinition[decorators]', 'MethodDefinition[decorators]', 'ClassBody.body > Decorator']}`

**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**

Expand Down
9 changes: 5 additions & 4 deletions apps/docs/docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
sidebar_position: 3
sidebar_label: Installation
description: How to install this package using npm or yarn?
title: Installation
---

# Installation
Expand Down Expand Up @@ -34,13 +35,13 @@ yarn add -D @nish1896/eslint-flat-config

### Eslint 8

We will be installing **v8.56.0** which was the last major version for eslint, before version 9 was released.
We will be installing **v8.57.0** which was the last major version prior to the release of version 9.

```
npm i eslint@8.56.0 --save-dev
npm i eslint@8.57.0 --save-dev
```
```
yarn add -D eslint@8.56.0
yarn add -D eslint@8.57.0
```

Next, install `@nish1896/eslint-config`.
Expand Down Expand Up @@ -70,7 +71,7 @@ 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.56.0
- [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
Expand Down
14 changes: 12 additions & 2 deletions apps/docs/docs/intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,27 @@
sidebar_position: 1
sidebar_label: Introduction
description: A brief introduction of @nish1896/eslint-config and what sets of rules does it use.
title: Introduction
---

# @nish1896/eslint-config
# nish1896-eslint-config

**[@nish1896/eslint-config](https://www.npmjs.com/package/@nish1896/eslint-config)**

![NPM Version](https://img.shields.io/npm/v/%40nish1896%2Feslint-config)
![NPM Downloads](https://img.shields.io/npm/dt/%40nish1896%2Feslint-config)
![node-current](https://img.shields.io/node/v/%40nish1896%2Feslint-config?color=%23e86267)
![GitHub Release Date - Published_At](https://img.shields.io/github/release-date/nishkohli96/eslint-config)

**[@nish1896/eslint-flat-config](https://www.npmjs.com/package/@nish1896/eslint-flat-config)**

![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 !**

Compatible with eslint 8 and 9!
Compatible with eslint `v8` and `v9`!

If you found this config useful, please don't forget to star the repository. It would make my day if you consider [buying me a coffee](https://www.buymeacoffee.com/nish1896)
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 @@ -4,7 +4,7 @@ sidebar_label: v1 to v2
description: Migration guide from v1 to v2 for this eslint-config.
---

# Migration Guide
# Migration from v1 to v2

**Starting v2 onwards, the linting rules for javascript and react have been split to purge out any unnecessary rules when using this config in a standalone nodejs application.**

Expand Down
10 changes: 8 additions & 2 deletions apps/docs/docs/rules-removed.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,25 @@
sidebar_position: 6
sidebar_label: Rules Removed
description: List of rules that were once included, but later removed from this config.
title: Rules Removed
---

### **Rules removed after initial or subsequent testing**
# **Rules Removed**

These rules were once included, but later removed from this config, 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 .eslintrc, if needed.

| Rule Name | Reason |
|-|-|
|[@stylistic/array-bracket-newline](https://eslint.style/rules/default/array-bracket-newline) & [@stylisticarray-element-newline](https://eslint.style/rules/default/array-element-newline)| Sometimes smaller array elements with more than 4 items can be wrapped in one line, whereas 3 items with longer character length, like list of urls need to be wrapped in new line |
|[@stylistic/comma-dangle](https://eslint.style/rules/default/comma-dangle) | Personal preference to retain or remove comma in arrays, objects, function args, imports and exports |
|[@stylistic/lines-around-comment](https://eslint.style/rules/default/lines-around-comment)| Sometimes reqd, when writing block comments above functions, but don't need when writing block comment between 2 lines of code |
|[@stylistic/no-mixed-operators](https://eslint.style/rules/default/no-mixed-operators)| gave err in `a + b * c`, assuming dev is sensible enough to add parens themselves when too many operators being used in a single line of code |
|[@stylistic/object-property-newline](https://eslint.style/rules/default/object-property-newline)| Inconsistent in formating object, making it hard to read |
|[@stylistic/newline-per-chained-call](https://eslint.style/rules/default/newline-per-chained-call) | This rule with default chain length 2 resulted in awkward readability when chaining operations |
|[@typescript-eslint/ban-ts-comment](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/ban-ts-comment.mdx) | A good developer will avoid writing ts-comments, except in extreme cases. Let's not cause them trouble to write one more line |
|[@typescript-eslint/no-this-alias](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/no-this-alias.md) | Sometimes `this` is reqd in fn context. eg. MongooseSchema.pre() |
|[arrow-body-style](https://eslint.org/docs/latest/rules/arrow-body-style)| Extra effort for developer if he needs to add some more code before returning from a function. |
|[dot-notation](https://eslint.org/docs/latest/rules/dot-notation)| prop name doesnt exist, but I have still assigned value for it. Using `obj?.['name']` would work but `obj.name` would throw ts err |
|[id-denylist](https://eslint.org/docs/latest/rules/id-denylist) | Use if required. eg. "id-denylist": ["warn", "e", "cb", 'callback']|
[id-length](https://eslint.org/docs/latest/rules/id-length)| Warning when using `_` for unused vars |
|[jsx-first-prop-new-line](https://eslint.style/rules/default/jsx-first-prop-new-line)||
Expand Down
5 changes: 2 additions & 3 deletions apps/docs/docs/rules/eslint.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,17 @@
sidebar_position: 2
sidebar_label: Eslint
description: Tabular list of Eslint js and jsx rules used in the config.
title: Eslint Rules
---

# Eslint rules
# Eslint

## **Javascript**

|Rule Name|🔧|
|-|-|
|[array-callback-return](https://eslint.org/docs/latest/rules/array-callback-return)||
|[arrow-body-style](https://eslint.org/docs/latest/rules/arrow-body-style)|| as-needed |
|[curly](https://eslint.org/docs/latest/rules/curly)||
|[dot-notation](https://eslint.org/docs/latest/rules/dot-notation)||
|[func-names](https://eslint.org/docs/latest/rules/)| as-needed |
|[no-debugger](https://eslint.org/docs/latest/rules/no-debugger)||
|[no-inline-comments](https://eslint.org/docs/latest/rules/no-inline-comments)||
Expand Down
1 change: 1 addition & 0 deletions apps/docs/docs/rules/index.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
sidebar_label: List of Rules
description: What plugins does this config uses and links to the list of all rules for these plugins.
title: Linting Rules
---

# List of Rules
Expand Down
9 changes: 8 additions & 1 deletion apps/docs/docs/rules/jsx-a11y.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,20 @@
sidebar_position: 4
sidebar_label: Jsx A11y
description: Tabular list of jsx-a11y rules used in the config.
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.

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)|
|[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.
:::
11 changes: 2 additions & 9 deletions apps/docs/docs/rules/stylistic.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
sidebar_position: 1
sidebar_label: Stylistic
description: Tabular list of Stylistic js and jsx rules used in the config.
title: Stylistic Rules
---

# Stylistic rules
# Stylistic

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

Expand All @@ -19,7 +20,6 @@ These rules are included in the `@nish1896/eslint-flat-config/js` and `@nish1896
|[arrow-spacing](https://eslint.style/rules/default/arrow-spacing)||
|[block-spacing](https://eslint.style/rules/default/block-spacing)||
|[brace-style](https://eslint.style/rules/default/brace-style)||
|[comma-dangle](https://eslint.style/rules/default/comma-dangle)| `never` or `{ arrays: 'never', objects: 'never', imports: 'never', exports: 'never', functions: 'never' }` |
|[comma-spacing](https://eslint.style/rules/default/comma-spacing)||
|[eol-last](https://eslint.style/rules/default/eol-last)||
|[function-call-argument-newline](https://eslint.style/rules/default/function-call-argument-newline)| consistent |
Expand All @@ -37,7 +37,6 @@ These rules are included in the `@nish1896/eslint-flat-config/js` and `@nish1896
|[no-trailing-spaces](https://eslint.style/rules/default/no-trailing-spaces)||
|[object-curly-newline](https://eslint.style/rules/default/object-curly-newline)| `{ consistent: true }` |
|[object-curly-spacing](https://eslint.style/rules/default/object-curly-spacing)| always |
|[object-property-newline](https://eslint.style/rulesobject-property-newline)||
|[operator-linebreak](https://eslint.style/rules/default/operator-linebreak)| before |
|[quotes](https://eslint.style/rules/default/quotes)| single |
|[rest-spread-spacing](https://eslint.style/rules/default/rest-spread-spacing)||
Expand Down Expand Up @@ -72,9 +71,3 @@ These rules are included in the `@nish1896/eslint-flat-config/jsx` and `@nish189
|[jsx-self-closing-comp](https://eslint.style/rules/default/jsx-self-closing-comp)||
|[jsx-wrap-multilines](https://eslint.style/rules/default/jsx-wrap-multilines)| parens-new-line |


The stylistic rule(s) listed below will give an error and will have to be manually fixed.

| Rule Name |
|-|
|[no-mixed-operators](https://eslint.style/rules/default/no-mixed-operators)|
Loading

0 comments on commit 4057c21

Please sign in to comment.