Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

eslint-flag-config, test-folders and docs #10

Merged
merged 54 commits into from
May 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
7cd2430
docusaurus setup
nishkohli96 May 4, 2024
40e9a2b
stylistic and eslint rules doc pages
nishkohli96 May 4, 2024
4d52bb2
code organization and complete docs
nishkohli96 May 12, 2024
6954bac
rm blog folder, from docs, upgrade dependencies
nishkohli96 May 12, 2024
82bc80b
migration wip
nishkohli96 May 12, 2024
4ab44c4
change file structure
nishkohli96 May 12, 2024
9c97fef
make v8 and v9 work
nishkohli96 May 12, 2024
9db2da3
test ts eslint with v9
nishkohli96 May 13, 2024
d01905b
ts eslint wip
nishkohli96 May 13, 2024
645a4ad
ts fix
nishkohli96 May 13, 2024
32d68db
test with flat config pkg
nishkohli96 May 13, 2024
9943c37
run yarn
nishkohli96 May 13, 2024
f52dbe9
fix import err
nishkohli96 May 13, 2024
d409a5e
integrate stylistic
nishkohli96 May 13, 2024
dabb7e4
try with react
nishkohli96 May 13, 2024
8977c29
try adding react plugins
nishkohli96 May 13, 2024
2b9d5f2
spread jsx, react plugins
nishkohli96 May 13, 2024
646cc91
separate repo for eslint-config-flat
nishkohli96 May 13, 2024
d624d73
rm array elements rule
nishkohli96 May 13, 2024
4259494
rm @stylistic/newline-per-chained-call rule
nishkohli96 May 13, 2024
bad6de3
modify header and footer for docs
nishkohli96 May 13, 2024
c7e60a9
docs rework in progress
nishkohli96 May 13, 2024
2fd468a
footer
nishkohli96 May 13, 2024
119283e
theming
nishkohli96 May 13, 2024
323390d
rename to eslint-flat-config
nishkohli96 May 14, 2024
9af30db
update docs
nishkohli96 May 14, 2024
30a1715
change engine in flat-config pkg.json
nishkohli96 May 14, 2024
cc5e69b
fix react folder
nishkohli96 May 14, 2024
4547775
env fix wip
nishkohli96 May 14, 2024
99b1562
rm browser from env in v8 js pkg
nishkohli96 May 14, 2024
704c7c3
wip
nishkohli96 May 14, 2024
cb36598
fix globals.browser err
nishkohli96 May 14, 2024
8c428fd
rm unused code
nishkohli96 May 14, 2024
5ec1aa0
use recommended code
nishkohli96 May 14, 2024
fab62ac
fix lint err
nishkohli96 May 14, 2024
3d7eff2
minor changes
nishkohli96 May 14, 2024
19663e6
rm react/jsx-uses-vars
nishkohli96 May 14, 2024
28c05d4
docs update wip
nish-kellton May 29, 2024
b43cca6
update docs
nishkohli96 May 29, 2024
ab17445
upgrade packages & docs
nishkohli96 May 29, 2024
6f46fef
update readme
nishkohli96 May 29, 2024
7fe0e40
object-curly-newline rule change
nishkohli96 May 29, 2024
1d66afe
code theme
nishkohli96 May 29, 2024
960fda0
update docs
nishkohli96 May 29, 2024
17f3479
update config for gh-pages deployment
nishkohli96 May 29, 2024
674ee1d
update github actions
nish-kellton May 30, 2024
11b6b68
update docs
nish-kellton May 30, 2024
506daae
fix build err
nish-kellton May 30, 2024
081bc28
update build path in github actions
nish-kellton May 30, 2024
94b77f3
update pkg.json
nish-kellton May 31, 2024
572c658
update hithub pages command
nish-kellton May 31, 2024
9dee6bc
fix links build err
nishkohli96 May 31, 2024
b00635b
github actions wip
nishkohli96 May 31, 2024
8efb97f
change brnch name
nishkohli96 May 31, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions .eslintrc.js

This file was deleted.

30 changes: 30 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Deploy Docusaurus to GitHub Pages

on:
push:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'

- name: Install dependencies
run: yarn

- name: Build Docusaurus site
run: yarn workspace @nish1896/eslint-config-docs build

- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: ./apps/docs/build
51 changes: 29 additions & 22 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,24 +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'
- name: Install Dependencies
run: npm ci
- name: release
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
# 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: 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 }}
289 changes: 0 additions & 289 deletions README.md

This file was deleted.

8 changes: 0 additions & 8 deletions Recommendations.md

This file was deleted.

20 changes: 20 additions & 0 deletions apps/docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Dependencies
/node_modules

# Production
/build

# Generated files
.docusaurus
.cache-loader

# Misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
41 changes: 41 additions & 0 deletions apps/docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Website

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.
3 changes: 3 additions & 0 deletions apps/docs/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
};
6 changes: 6 additions & 0 deletions apps/docs/docs/changelog/_category_.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
position: 8
label: Changelog
collapsible: true
collapsed: true
customProps:
description: Changes done while upgrading each version.
43 changes: 7 additions & 36 deletions Changelog.md → apps/docs/docs/changelog/v1.md
Original file line number Diff line number Diff line change
@@ -1,39 +1,10 @@
# **What's changed?**
---
sidebar_position: 2
sidebar_label: v1.0.x
description: Changelog and release dates for v1 of this eslint-config.
---

## [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.
# **What's changed ?**

## [1.0.4](https://github.com/nishkohli96/eslint-config/tree/v1.0.4)

Expand All @@ -51,7 +22,7 @@ Remove comma dangle from arrays and objects, as traling commas were creating unn

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](/README.md) thanks to [Shields.io](https://shields.io/) !
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)

Expand Down
68 changes: 68 additions & 0 deletions apps/docs/docs/changelog/v2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
---
sidebar_position: 1
sidebar_label: v2.0.x
description: Changelog and release dates for v2 of this eslint-config.
---

# **What's changed?**

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

**Released - 30 May, 2024**

<p style={{ fontSize: "25px" }}>Official Docs 📖 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 🗑️ |
|[@stylistic/object-curly-newline](https://eslint.style/rules/default/object-curly-newline)| `multiline` -> `consistent` |

**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.
89 changes: 89 additions & 0 deletions apps/docs/docs/installation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
---
sidebar_position: 3
sidebar_label: Installation
description: How to install this package using npm or yarn?
---

# Installation

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).

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.56.0** which was the last major version for eslint, before version 9 was released.

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

Next, install `@nish1896/eslint-config`.

```
npm install @nish1896/eslint-config --save-dev
```
```
yarn add -D @nish1896/eslint-config
```


Add *"lint"* command to your `package.json` file.

```
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 -
- [eslint/recommended](https://www.npmjs.com/package/eslint) - 9.3.0 & 8.56.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
:::

**You may also choose to install other eslint plugins or configurations depending upon your application needs.**

- [eslint-config-airbnb](https://www.npmjs.com/package/eslint-config-airbnb)
- [eslint-plugin-import](https://www.npmjs.com/package/eslint-plugin-import)
- [eslint-plugin-json](https://www.npmjs.com/package/eslint-plugin-json)
- [eslint-plugin-jsonc](https://www.npmjs.com/package/eslint-plugin-jsonc)
- [eslint-plugin-node](https://www.npmjs.com/package/eslint-plugin-node)
- [eslint-plugin-promise](https://www.npmjs.com/package/eslint-plugin-promise)
Loading