You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 7, 2019. It is now read-only.
Copy file name to clipboardExpand all lines: README.md
+17-48
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
3
3
> Write bulletproof JavaScript like a pro!
4
4
5
-
**ESLint version required:**`>=1.9.0`
5
+
**ESLint version required:**`>=2.0.0`
6
6
7
7
## About
8
8
@@ -15,79 +15,48 @@ This repository contains various configuration files for the awesome JavaScript
15
15
16
16
The goal of this project is to help all developers write better code. It should not be a hindrance or cause a major fight about how to write it. Although it will never achieve the "one-config-suits-all" status in terms of coding style, it should achieve that when it comes to writing safe JavaScript.
17
17
18
-
One or two options for coding style will eventually be provided, preferably after reaching a consensus across the company.
19
-
20
18
## Structure
21
19
22
20
The ESLint rules are semantically grouped into various categories for easy composition.
23
21
24
-
### [Standard](standard)
25
-
26
-
These rules are useful to all JavaScript codebases, regardless of platform or developers' coding style preferences. The goal of the Standard rules is to flag unsafe, dangerous or plain-broken JavaScript code. Examples include use of undeclared variables, detecting unreachable code or flagging variables that are no longer used.
27
-
28
-
> Generally you won't need to use these configuration files directly as they are incorporated into individual environment configurations.
29
-
30
22
### [Environments](environments)
31
23
32
-
These rules are only useful within a specific JavaScript environment, i.e. Node.js. The goal of these rules is to provide a configuration which makes writing code within this environment safer and to configure ESLint specifically for it (i.e. by defining known global variables or enabling certain ES 2015 known to be already implemented).
24
+
These rules are the ones you should be including in your *.eslintrc* configuration. They are separated into categories based on the environment for which the code is being developed. Additionally, each environment provides several levels of "strictness" which the developer can choose from. This level of separation is meant as a means to gradual adoption of **all the rulesets**.
33
25
34
-
**All environment-specific configuration files should inherit from configurations in [Standard](standard).**
26
+
> It is recommended for new projects to include all levels.
35
27
36
28
### [Coding Styles](coding-styles)
37
29
38
-
These rules help developers adhere to a certain coding style. They do not provide additional safety, but help developers write code in a way that is consistent across the whole codebase, which in long term helps them better maintain that code.
30
+
These rules help developers adhere to a certain coding style. They do not provide code safety, but help developers write code in a way that is consistent across the whole codebase, which in long term helps them better maintain that code.
39
31
40
-
These rules are intended to be used independently on platform.
32
+
These rules are intended to be used independently on platform. However, you should still consider including rules for your environment if you really care about high-quality JavaScript.
41
33
42
34
## Usage
43
35
44
-
### Initialisation
45
-
46
-
You will need to put these files into your project somehow. Here are some options:
47
-
48
-
- Copy/paste these files into a folder within your project (**not recommended**)
49
-
- Add this repository as a git submodule (**preferred**)
50
-
- Add this repository as `npm` dev dependency (see [here](https://docs.npmjs.com/cli/install))
36
+
### Installation
51
37
52
-
Everyone knows how to copy/paste stuff. Let's look at the second option:
38
+
This package can be installed via npm using Github-URL:
Where `destination-dir` is an optional folder name of your choice where to put the files (defaults to this project's name).
59
-
60
-
When you later want to update the ruleset to a newer git revision, `cd` into the submodule's directory and pull, just like any other git repo:
61
-
62
-
```sh
63
-
# Assuming this is the folder where you decided to put the submodule
64
-
cd js-coding-standards
65
-
git pull
66
-
# Don't forget to commit this "update" in your main project!
67
-
cd ..
68
-
git add js-coding-standards
69
-
git commit
70
-
```
42
+
> Note that the package will be installed as `eslint-config-javascript`, because that's what the package's name is.
71
43
72
44
### Configuration
73
45
74
-
Once you have the rules in place, you must create your own *.eslintrc* configuration file in your project's root and include those configuration files that you want to use for this project. See the [examples](examples) directory for some hints.
75
-
76
-
> **Note:** Starting from ESLint 1.10, using extensionless *.eslintrc* is **deprecated** - you should always create this file with a supported file extension (`.json`, `.js`, `.yml`, `.yaml`). See ESLint's [release notes for 1.10][eslint-release-1-10] for more information.
46
+
Once the ruleset is installed, you must create your own *.eslintrc* configuration file in your project's root and include those rulesets that you want to use. See the [examples](examples) directory for, well... examples.
77
47
78
48
## Status
79
49
80
-
-**standard:**Feedback required
50
+
-**standard:**Finished
81
51
-**environments**
82
-
- nodejs: Feedback required
83
-
- front-end: Not started
84
-
- Babel: Not started
85
-
-**coding-styles:** WIP
86
-
87
-
## Feedback
52
+
- nodejs: Finished
53
+
- browser: Not started
54
+
- babel: Not started
55
+
-**coding-styles:** Feedback required
88
56
89
-
This project is supposed to be a collaborative effort of the whole company, therefore you are invited to provide suggestions and feedback via Github issues & pull requests.
57
+
## License
90
58
59
+
This software is licensed under the **BSD-3-Clause License**. See the [LICENSE](LICENSE) file for more information.
Copy file name to clipboardExpand all lines: environments/nodejs/README.md
+9-7
Original file line number
Diff line number
Diff line change
@@ -4,18 +4,20 @@ These configuration files are suitable to lint code which will run on Node.js.
4
4
5
5
## Configurations
6
6
7
-
### latest.yml
7
+
### javascript/environments/nodejs/latest
8
8
9
-
Suitable for the very latest version of Node.js. It configures ESLint to allow known ES 2015 features as well as includes Node-specific ruleset for known errors.
9
+
Suitable for the very latest version of Node.js. It configures ESLint to allow known ES 2015 features and disallow those still missing as well as includes Node-specific ruleset for known errors.
10
10
11
-
### legacy.yml
11
+
### javascript/environments/nodejs/legacy
12
12
13
13
Suitable for legacy versions of Node.js (0.12 and older). Also includes Node-specific rulesets for known errors.
14
14
15
-
### best-practices.yml
15
+
### javascript/environments/nodejs/best-practices
16
16
17
-
Use in conjunction with one of the version-specific configuration files. Provides additional safety checks to flag potentially unsafe code.
17
+
Use this ruleset in conjunction with one of the version-specific configuration files. Provides additional safety checks to flag potentially unsafe code.
18
18
19
-
### optional.yml
19
+
### javascript/environments/nodejs/optional
20
20
21
-
Use in conjunction with any of the above. Provides additional insights into potential inconsistencies or mistakes in the project.
21
+
Use this ruleset in conjunction with any of the above. Provides additional insights into potential inconsistencies in the project.
22
+
23
+
> For new projects, it is recommended to enable this ruleset. For existing projects, it is only recommended for the brave.
To use these rulesets, you must have an *.eslintrc* configuration file present in your project root. In this file, you then include those configuration which you would like to use in your project.
4
-
5
-
> **Note:** Starting from ESLint 1.10, using extensionless *.eslintrc* is **deprecated** - you should always create this file with a supported file extension (`.json`, `.js`, `.yml`, `.yaml`). See ESLint's [release notes for 1.10][eslint-release-1-10] for more information.
6
-
7
-
The following example uses YAML syntax.
8
-
9
-
```yaml
10
-
---
11
-
# The extends directive allows composition of configuration files
12
-
extends:
13
-
# Each file adds rule definitions over the previous file, potentially
14
-
# overwriting some configuration options. Here, we are including the
15
-
# base configuration for Node.js development and we opt-in to the
# If you need to override some rules specifically for this project,
21
-
# you can do so as usual via the rules property.
22
-
# Per-project rules take precedence over rules defined via included
23
-
# configurations.
24
-
rules:
25
-
# Enable the valid-jsdoc rule and report violations as hard errors
26
-
valid-jsdoc: 2
3
+
To use these rulesets, you must have an *.eslintrc* configuration file present in your project root. In this file, you then include those rulesets which you would like to use in your project.
4
+
5
+
The path to the ruleset must start with `eslint-config-javascript` (this ruleset's package name). Optionally, ESLint allows to drop the `eslint-config` to keep it short. The rest of the path is an actual folder/file in this repository. Extensions can be omitted. For detailed explanation, see ESLint's [shareable configs][shareable-configs].
6
+
7
+
Your configuration file can either be json, classic Node.js module, or YAML file.
8
+
9
+
```js
10
+
// .eslintrc.js
11
+
12
+
module.exports= {
13
+
// The extends directive allows composition of configuration files
14
+
extends: [
15
+
// Each file adds rule definitions over the previous file, potentially
16
+
// overwriting some configuration options. Here, we are including the
17
+
// base configuration for Node.js development and we opt-in to the
18
+
// best-practices ruleset.
19
+
'javascript/environments/nodejs/latest',
20
+
'javascript/environments/nodejs/best-practices',
21
+
// If you are brave enough, you can also extend the "optional" ruleset
22
+
'javascript/environments/nodejs/optional'
23
+
],
24
+
25
+
// If you need to override some rules specifically for this project,
26
+
// you can do so as usual via the rules property.
27
+
// Per-project rules take precedence over rules defined via included
0 commit comments