5.0.12 โ€ข Published 8 months ago

@ijsto/eslint-config v5.0.12

Weekly downloads
390
License
MIT
Repository
github
Last release
8 months ago

ESLint and Prettier setup for VS Code

  • A set of awesome ESLint + Prettier configs.
  • Makes it easier to work with React, Next.js, Node apps.
  • This package is intended for use with VS Code, however, can be easily used with any text editors.

This package will automatically detect if you're using React, Next.js, Node (and other in near future), and apply appropriate linting rules. ๐Ÿ‘Œ๐Ÿผ

Installation

You may need to restart VSCode once installed.

First installation will take you only a couple of minute, every subsequent should not take more than a minute.

You can install the package 2.a) in repo of the project which will apply the linting only to the project and not other files on your computer or 2.b) on your computer which will apply the linting to all files with the included file extensions on your computer.

Below are the steps to install (click on the step to open the instructions).

  1. Install ESLint extension
  2. Add below snippet to your User settings:

    First try (โŒ˜Cmd + , or Ctrl + ,) โ†’ type in settings.json file โ†’ click on Edit in settings.json. If that doesn't work the file is located in $/Code/User/settings.json

{
  // ...
  // Run formatter when you save code changes
  "editor.codeActionsOnSave": {
    "source.fixAll.eslint": true
  },
  // Disable default formatting (ESLint formatting will be used instead)
  "[javascript]": {
    "editor.formatOnSave": false
  },
  "[javascriptreact]": {
    "editor.formatOnSave": false
  },
}

Install

  1. Install @ijsto/eslint-config:

    this command will auto-detect if you are using yarn by default and prompt you to confirm before proceeding.

npx install-peerdeps --dev @ijsto/eslint-config
  1. Create an .eslintrc file in the root of your project's directory. Paste in the following:
{
  "extends": "@ijsto"
}
  1. You're done!

  2. ESLint will now run and format your code each time you save your file.

If you would like to install the config computer-wide (globally) and not on each project, follow the below steps.

Install

  1. Install @ijsto/eslint-config:

    this command will auto-detect if you are using yarn by default and prompt you to confirm before proceeding.

npx install-peerdeps --global @ijsto/eslint-config
  1. Create a global .eslintrc file on your computer:
  • MacOS location: ~/.eslintrc
  • Windows location: C:\Users\you\.eslintrc

Paste in the follow to newly created .eslintrc:

{
  "extends": "@ijsto"
}

Typescript

โš ๏ธ Currently eslint v8 will break the TypeScript support.

Some-what relevant: https://github.com/eslint/eslint/issues/15149

If you would like to use this config with TypeScript, all you need to do is:

  1. Install TypeScript dependencies:
   yarn add --dev @typescript-eslint/eslint-plugin @typescript-eslint/parser eslint prettier
  1. Add the following to .eslintrc file
{
  // ...other configs
  "parser": "@typescript-eslint/parser", // <-- Add this
  "plugins": ["@typescript-eslint", /* ...otherPlugins */], // <-- Add this
  "extends": [ // <-- `extends` is now an array and not an object
    "@ijsto", 
    "plugin:@typescript-eslint/eslint-recommended", // <-- Add this
    "plugin:@typescript-eslint/recommended" // <-- Add this
  ]
  // ...other configs
}

How to Uninstall

If something doesn't work or you should try manually deleting your node_modules folder. This usually helps resolving any issues with this config not working.

If you would like to uninstall this eslint-config, run the below commands:

Local uninstall (per project)

yarn remove eslint @ijsto/eslint-config

or global (computer-wise)

npm remove eslint @ijsto/eslint-config

Global uninstall

yarn global remove eslint @ijsto/eslint-config

or

npm remove --global eslint @ijsto/eslint-config

That's all.

Did this package help you? Give it a โ˜… and share with your friends! ๐Ÿ™‚

PRs, feature requests or suggestions are most welcome!

iJS.to

Troubleshooting

If you followed the steps, yet still cannot get ESLint to work, you can try deleting /node_modules and running yarn or npm i depending on which one you use.

Insert '..' eslint(prettier/prettier)

  • This eslint error can sometimes occur when you have clashing formatters. The easiest solution if to change the default formatter in your VS Code settings to ESLint (tutorial coming soon).

Contributing ๐Ÿ’ช๐Ÿผ

Thank you for considering to contribute to this project.

We are working on improving the contributing guidelines, for now, here is current TODO list:

  • Handle workspaces (see TODO:s in index.js file)
  • Create CONTRIBUTING.md file with guidelines
5.0.9

8 months ago

5.0.8

8 months ago

5.0.7

8 months ago

5.0.6

8 months ago

5.0.5

8 months ago

5.0.4

8 months ago

5.0.3

8 months ago

5.0.2

8 months ago

5.0.1

8 months ago

5.0.10

8 months ago

5.0.0

8 months ago

5.0.11

8 months ago

5.0.12

8 months ago

4.5.3

1 year ago

4.5.21

1 year ago

4.5.0

1 year ago

4.5.2

1 year ago

4.5.1

1 year ago

4.4.3

1 year ago

4.4.2

2 years ago

4.4.1

2 years ago

4.4.0

2 years ago

4.3.2

2 years ago

4.3.1

2 years ago

4.3.3

2 years ago

4.3.0

2 years ago

4.2.5

3 years ago

4.2.4

3 years ago

4.2.7

3 years ago

4.2.6

3 years ago

4.1.7

3 years ago

4.2.3

3 years ago

4.2.2

3 years ago

4.2.1

3 years ago

4.2.0

3 years ago

3.0.2

3 years ago

4.0.5

3 years ago

4.0.4

3 years ago

4.0.7

3 years ago

4.0.1

3 years ago

4.0.0

3 years ago

4.0.3

3 years ago

4.0.2

3 years ago

4.0.16

3 years ago

4.0.15

3 years ago

4.0.18

3 years ago

4.0.17

3 years ago

4.0.12

3 years ago

4.0.11

3 years ago

4.0.14

3 years ago

4.0.13

3 years ago

4.0.9

3 years ago

4.0.8

3 years ago

4.1.4

3 years ago

4.1.3

3 years ago

4.1.6

3 years ago

4.1.5

3 years ago

4.1.0

3 years ago

4.1.2

3 years ago

4.1.1

3 years ago

3.0.1

4 years ago

2.1.49

4 years ago

2.1.47

4 years ago

2.1.48

4 years ago

2.1.45

4 years ago

2.1.46

4 years ago

2.1.43

4 years ago

2.1.44

4 years ago

2.1.42

4 years ago

3.0.0

4 years ago

2.1.51

4 years ago

2.1.41

4 years ago

2.1.40

4 years ago

2.1.29

4 years ago

2.1.38

4 years ago

2.1.39

4 years ago

2.1.36

4 years ago

2.1.37

4 years ago

2.1.34

4 years ago

2.1.35

4 years ago

2.1.32

4 years ago

2.1.33

4 years ago

2.1.30

4 years ago

2.1.31

4 years ago

2.1.28

4 years ago

2.1.27

4 years ago

2.1.25

4 years ago

2.1.26

4 years ago

2.1.24

4 years ago

2.1.23

4 years ago

2.1.22

4 years ago

2.1.21

4 years ago

2.1.20

4 years ago

2.1.19

4 years ago

2.1.18

4 years ago

2.1.16

4 years ago

2.1.15

4 years ago

2.1.14

4 years ago

2.1.13

4 years ago

2.1.12

4 years ago

2.1.11

4 years ago

2.1.9

4 years ago

2.1.10

4 years ago

2.1.8

4 years ago

2.1.7

4 years ago

2.1.4

4 years ago

2.1.6

4 years ago

2.1.5

4 years ago

2.1.3

4 years ago

2.1.2

4 years ago

2.1.1

4 years ago

2.1.0

4 years ago

2.0.5

4 years ago

2.0.4

4 years ago

2.0.3

4 years ago

2.0.2

4 years ago

2.0.1

4 years ago

2.0.0

4 years ago