2.0.0 • Published 12 months ago

@thron/eslint-config v2.0.0

Weekly downloads
-
License
-
Repository
-
Last release
12 months ago

Shareable Eslint Configuration

A shareable Eslint configuration for speed up development, and having a single place to edit rules.

How to use

Install via npm by running:

npm install --save-dev @thron/eslint-config

or manually by cloning the repository and using npm link.

Now the only thing to do is extending it in your project ... and all the work it's done!

    {
        "extends": ["@thron"]
    }

Composition

The package contains multiple configurations, which can be extended separately. The main reason of this choice is that projects could require different rules and configurations, based on languages, framework, compilers. Using this approach, you can simply extend the configurations you need, always maintaining consistency in the code.

Important: Our advice is to always extend the main configuration which contains cross-project rules (based on es6 env).

Configurations

  • Main Configuration : The main configuration contains all the basic rules valid for every kind of Js project.

It can be extended like this:

    {
        "extends": ["@thron"]
    }
  • Vue Configuration : This configuration is specific for projects which use VueJs. It contains a custom parser, and a set of rules that adds better Vue files support.

It can be extended like this:

    {
        "extends": ["@thron/eslint-config/vue"]
    }
  • Security Configuration : This configuration is used to prevent potential security hotspot in Node projects.

It can be extended like this:

    {
        "extends": ["@thron/eslint-config/security"]
    }
  • Jest Configuration This configuration is specific for projects which use Jest as test framework. It contains custom rules, specifically made for Jest, that adds a better dev experience writing text.

It can be extended like this:

	{
		"extends": ["@thron/eslint-config/jest"]	
	}

IMPORTANT The configuration doesn't add any custom global to your configuration. If you have global objects like THRON or THRONContentExperience you can add them in this way in your configuration:

	{
		"globals": {
			"THRON": "readonly",
			"THRONContentExperience": "readonly"
		}
	}

Dependencies

Due to an Eslint bug, you need to have the associated plugins installed. We recommend adding the as dependencies in your project. ( issue ) Based on the configuration you use, you need these plugins:

  • eslint-plugin-import: Used in the main configuration for a better handling of imports.

  • eslint-plugin-security: Used in the security configuration. Add a set of rules to prevent security issues.

  • eslint-plugin-vue: Used in the vue configuration. Add a set of rules for vue files.

  • eslint-plugin-jest: Used in the jest configuration. Add a set of rules for Jest framework.

Things to know

  • The main configuration uses babel-eslint as parser to support stage feature that Eslint default parser doesn't support, and it opts to use the eslint-plugin-babel rules over the ESLint rules to support rules for these features as well.

  • The main configurations is composed by multiple configurations. You can use them individually even if it is not recommended if you want to apply only a small piece of the all set of rules.

  • The configuration has Ecma2018 as main EcmaVersion. Also, it does not contain any env (ex: browser,node) because the purpose of it is to have general configurations which works in all our projects. So it's up to you to define the environment of your project!

  • The Vue configuration uses a custom Vue parser for a better <template> tag support. Under the hood it always uses babel-eslint, but it adds some new features to it.

  • The Jest configuration uses eslint-plugin-jest to add specific rules for Jest framework. It doesn't import any js rules, so to have a correctly linted project the main configuration is needed.

2.0.0-rc.2

12 months ago

2.0.0-rc.3

12 months ago

2.0.0-rc.4

12 months ago

2.0.0-rc.5

12 months ago

2.0.0-rc.0

12 months ago

2.0.0-rc.1

12 months ago

2.0.0-rc.6

12 months ago

2.0.0-rc.7

12 months ago

2.0.0

12 months ago

1.2.0

1 year ago

1.1.0

1 year ago

1.3.0

1 year ago

1.0.0-rc.5

1 year ago

1.0.0-rc.6

1 year ago

1.2.0-rc.2

1 year ago

1.0.0-rc.3

1 year ago

1.2.0-rc.1

1 year ago

1.0.0-rc.4

1 year ago

1.2.0-rc.0

1 year ago

1.0.0-rc.1

1 year ago

1.0.0-rc.2

1 year ago

1.0.0-rc.0

1 year ago

1.2.0-rc.3

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago

0.4.3

2 years ago

0.4.2

2 years ago

0.4.2-dev.0

2 years ago

0.4.1

2 years ago

0.4.0

2 years ago

0.4.0-rc.2

2 years ago

0.4.0-rc.1

2 years ago

0.4.0-rc.0

3 years ago

0.3.0

3 years ago

0.2.0

3 years ago

0.2.0-rc.4

3 years ago

0.2.0-rc.3

3 years ago

0.2.0-rc.2

3 years ago

0.2.0-rc.0

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago