Skip to content
This repository was archived by the owner on Mar 7, 2019. It is now read-only.

Commit eb3a5aa

Browse files
Update READMEs
1 parent 2d0263f commit eb3a5aa

File tree

3 files changed

+58
-80
lines changed

3 files changed

+58
-80
lines changed

README.md

+17-48
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
> Write bulletproof JavaScript like a pro!
44
5-
**ESLint version required:** `>=1.9.0`
5+
**ESLint version required:** `>=2.0.0`
66

77
## About
88

@@ -15,79 +15,48 @@ This repository contains various configuration files for the awesome JavaScript
1515

1616
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.
1717

18-
One or two options for coding style will eventually be provided, preferably after reaching a consensus across the company.
19-
2018
## Structure
2119

2220
The ESLint rules are semantically grouped into various categories for easy composition.
2321

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-
3022
### [Environments](environments)
3123

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**.
3325

34-
**All environment-specific configuration files should inherit from configurations in [Standard](standard).**
26+
> It is recommended for new projects to include all levels.
3527
3628
### [Coding Styles](coding-styles)
3729

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.
3931

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.
4133

4234
## Usage
4335

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
5137

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:
5339

54-
Within your project, do:
40+
`npm install --save-dev strvcom/js-coding-standards`
5541

56-
`git submodule add https://github.com/strvcom/js-coding-standards.git [destination-dir]`
57-
58-
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.
7143
7244
### Configuration
7345

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.
7747

7848
## Status
7949

80-
- **standard:** Feedback required
50+
- **standard:** Finished
8151
- **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
8856

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
9058

59+
This software is licensed under the **BSD-3-Clause License**. See the [LICENSE](LICENSE) file for more information.
9160

9261
[eslint-url]: http://eslint.org
9362
[eslint-release-1-10]: http://eslint.org/blog/2015/11/eslint-v1.10.0-released/#configuration-file-formats

environments/nodejs/README.md

+9-7
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,20 @@ These configuration files are suitable to lint code which will run on Node.js.
44

55
## Configurations
66

7-
### latest.yml
7+
### javascript/environments/nodejs/latest
88

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.
1010

11-
### legacy.yml
11+
### javascript/environments/nodejs/legacy
1212

1313
Suitable for legacy versions of Node.js (0.12 and older). Also includes Node-specific rulesets for known errors.
1414

15-
### best-practices.yml
15+
### javascript/environments/nodejs/best-practices
1616

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.
1818

19-
### optional.yml
19+
### javascript/environments/nodejs/optional
2020

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.

examples/README.md

+32-25
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,36 @@
11
# Project configuration examples
22

3-
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
16-
# best-practices ruleset.
17-
- ./js-coding-standards/environments/nodejs/latest.yml
18-
- ./js-coding-standards/environments/nodejs/best-practices.yml
19-
20-
# 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
28+
// configurations.
29+
rules: {
30+
'valid-jsdoc': 2
31+
}
32+
}
2733
```
2834

29-
[eslint-release-1-10]: http://eslint.org/blog/2015/11/eslint-v1.10.0-released/#configuration-file-formats
35+
36+
[shareable-configs]: http://eslint.org/docs/developer-guide/shareable-configs.html#using-a-shareable-config

0 commit comments

Comments
 (0)