2.2.2 • Published 2 years ago

eslint-config-rasenplanscher v2.2.2

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Due to a shift in focus and plans for additional features out of scope for a package like this, there is now a successor, in spirit and in code:
👉 @professional-js/eslint-config (GitHub)

That package has the exact same feature set at the time of writing but will be maintained and extended. Work on eslint-config-rasenplanscher ceases immediately and completely.

Please make sure to switch.

eslint-config-rasenplanscher

This package provides a reasoned reactive shareable ESLint configuration in several variations.

What does that mean?

“reasoned”

The settings in this configuration are not generally built on gut feelings but on reasoning regarding how code formatting can improve productivity. All of that is documented in the project itself, so if you want to know why a rule is configured as it is, look at the markdown files you can find in the Github repository.

If you disagree with something rationally, please open an issue to help me correct my thinking. If you disagree based on a gut feeling, please keep it to yourself until you either understand the truth found here or you can make a rational argument.

Also, if you'd like a setting that's missing here, just open a PR and it shall be included if the reasoning is up to snuff.

Note
Due to time constraints, this goal has been de-prioritized. If you are unclear why a certain rule is configured the way it is, please open an issue. PRs are also still welcome, of course.

“reactive”

This configuration determines whether your project uses the eslint plugins it has rules for and only activates those rules for the available plugins. That way, you can set up your project and just add the plugins you're interested in. The configuration will handle the rest.

And yes, on first publish, there's only a few rules. Live with it or get active!

“shareable”

That's eslint-speak for an npm package that you can add to your project's dev dependencies and include in your estlintrc's extends configuration.

variations

I hope that this will be interesting to others than myself. Therefore, I want to enable others to use this to the degree they are comfortable with. What that means is that you can use all the rules in here, just the most important ones, or something in between that will cover a lot but leave you in peace with what goes into the area of nit-picking.

What's in it, how to use it

First, install it (as well as the plugins you want):

npm install --save-dev eslint-config-rasenplanscher eslint@^8.7.0 @typescript-eslint/eslint-plugin@^5.10.0 @typescript-eslint/parser@^5.10.0 eslint-plugin-compat@^4.0.2 eslint-plugin-import@^2.25.4 eslint-plugin-node@^11.1.0 eslint-plugin-react@^7.28.0 eslint-plugin-simple-import-sort@^7.0.0 eslint-plugin-unused-imports@^2.0.0

Then either add this to your package.json:

	"eslintConfig": {
		"root": true,
		"extends": "rasenplanscher",
		"parserOptions": {
			"ecmaVersion": 2021,
			"sourceType": "module"
		}
	},

…or create a file named .eslintrc.json with following contents in the root folder of your project:

{
	"root": true,
	"extends": "rasenplanscher",
	"parserOptions": {
		"ecmaVersion": 2021,
		"sourceType": "module"
	}
}

When using @typescript-eslint/eslint-plugin (you should 😉), you need to also add @typescript-eslint/parser to your dependencies and set the appropriate typescript configuration:

{
	"root": true,
	"extends": "rasenplanscher",
	"parserOptions": {
		"ecmaVersion": 2021,
		"project": "./tsconfig.json",
		"sourceType": "module"
	}
}

If your project is a multi-package monorepo, see @typescript-eslint's docs on configuring a monorepo.

If you want to relax or strengthen your setup, you can choose from these setups (from smallest to largest):

  • rasenplanscher/eslintrc.important: The really important rules that will actually prevent errors – Never go without these!
  • rasenplanscher: Adds more rules that will help avoid confusion. Most projects will profit from these.
  • rasenplanscher/eslintrc.all: Adds more rules. These will help legibility, and therefore maintainability. Since these will be regarded as just “personal preference” by some people, they are opt-in.
  • rasenplanscher/eslintrc.all.dangerzone: Modifies a few rules to enable some advanced patterns that really should be used only by those who really know what they do. If you want to use this, first familiarize yourself with the Pro Tips of dangerzone-enabled rules. If you don't know how, this is not for you yet.

⚠ dangerzone

If you want more control over what's going on, especially if you want to go into the danger zone step by step (which is definitely recommended), your best friend is eslintrc.make.js which exposes the API that the ready-made extendable files use themselves:

// eslintrc.js in your project
module.exports = require('eslint-config-rasenplanscher/eslintrc.make')({
	priorities: [ 'IMPORTANT', 'HELPFUL', 'TASTE' ],
	dangerzone: [ 'curly' ],
	overrides: {
		root: true,
		parserOptions: {
			ecmaVersion: 2021,
		},
	},
})

Changelog

2.2.1

  • fix README

2.2.0

2.1.0

2.0.0

1.3.0

1.2.0

1.1.0

1.0.0

2.2.1

2 years ago

1.2.0

2 years ago

2.2.0

2 years ago

1.1.0

2 years ago

2.2.2

2 years ago

2.1.0

2 years ago

2.0.0

2 years ago

1.3.0

2 years ago

1.0.0

3 years ago