README
eslint-config-conaclos
This package provides gradual and personal ESLint sharable configurations.
Content
Configurations
The package proposes 3 configurations and 3 mods.
base is for an ES5-compliant projects.
Prefer use esnext-base for an ES2015 (ES6) or ES2016+ projects. It enforces the use of ES2015 (ES6) features.
Prefer use ts-base for TypeScript projects. It uses TypeScript specific linting rules.
Mods
By default the above configurations enable both browser and node environments. browser-mod enables browser environment.
node-mod enables node environment.
dist-mod (distribution mod) is suitable for checking your distribution. It reports the use of console and other non-standard features.
Usage
ESLint shareable configuration may be used with the extends
property
of .eslintrc
files.
See ESLint ignore for ignoring files and directories.
Create `.eslintrc' and paste:
{
"extends": "conaclos"
}
By default the configuration esnext-base
is used.
You can choose another configuration.
e.g. if you prefer ts-base
you just need to replace conaclos with
conaclos/ts-base:
{
"extends": "conaclos/ts-base"
}
If you like standardJS styling convention, you can combine it with a basic configuration file:
{
"extends": [
"conaclos",
"standard"
]
}
Don't forget to add "standard" as dev. dependency.
Always place a mod after the main configuration:
{
"extends": [
"conaclos",
"conaclos/dist-mod",
"conaclos/browser-mod"
]
}
Rule overriding
You can also override a rule if you think it is too strict. For example if you think that the use of environment variable in your source files is not harmful, you can disable the rule:
{
"extends": "conaclos",
"rule": {
"no-process-env": 0
}
}
Replace 0
with 1
to report a warning.
Globals
If your project uses libraries that populate the global scope, ESLint can report their global variables as undefined (no-def).
ESLint enables both their declaration at a file and project level. Their declaration at a file level enables to explicitly declare them as a dependency. This is achievable by the use of a special comment on the first line of a file:
/*global gvar1 gvar2 */
// `gvar1' and `gvar2' are considered as defined.
Install
npm install --save-dev eslint eslint-config-conaclos
Alternatively if you use TypeScript:
npm install --save-dev eslint eslint-config-conaclos @typescript-eslint/parser @typescript-eslint/eslint-plugin
Why this is reported?
no-console warns the use of console.log
in your source files.
console.log
should only be used for debugging purpose.
Prefer use console.{info, warn, error}
for logging purpose.
License
The zlib license