-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Nicola Racco
committed
Aug 22, 2017
0 parents
commit be571a3
Showing
6 changed files
with
100 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# editorconfig.org | ||
|
||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
end_of_line = lf | ||
indent_style = space | ||
indent_size = 2 | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# MIKAMAI's official Code Dress Code | ||
|
||
## What any project should contain | ||
|
||
1. [A language manager config file](#language-version-manager); | ||
1. [Editorconfig](#editorconfig); | ||
1. [A Linting tool](#linting-tool); | ||
|
||
### Language version manager | ||
|
||
For single-language projects there's no mandatory tool to use, just use the same tool across the team. For multi-language projects (e.g. Rails + React app), [asdf](https://github.com/asdf-vm/asdf) needs to be used. | ||
|
||
*The language manager config file needs to be kept under version control.* | ||
|
||
### Editorconfig | ||
|
||
We use [Editorconfig](http://editorconfig.org) to keep the same coding standard across our editors. Download our [.editorconfig](.editorconfig) inside your project and ensure your editor is properly configured. | ||
|
||
### Linting tool | ||
|
||
For javascript we use [ESLint](eslint.org). See [our configuration](eslint/). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
**/node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# ESLint configuration | ||
|
||
We like [Airbnb styling conventions](https://github.com/airbnb/javascript), and we try to follow them, with some exceptions. | ||
|
||
## Installation | ||
|
||
**Non-jsx projects:** | ||
|
||
```bash | ||
$ npm install eslint eslint-plugin-import eslint-config-airbnb-base | ||
$ curl -o .eslintrc.yml https://github.com/mikamai/dress-code/raw/master/eslint/js.eslintrc.yml | ||
$ curl -O https://github.com/mikamai/dress-code/raw/master/eslint/.eslintignore | ||
``` | ||
|
||
**JSX projects:** | ||
|
||
```bash | ||
$ npm install eslint eslint-plugin-import eslint-config-airbnb-base eslint-plugin-react eslint-plugin-jsx-a11y | ||
$ curl -o .eslintrc.yml https://github.com/mikamai/dress-code/raw/master/eslint/jsx.eslintrc.yml | ||
$ curl -O https://github.com/mikamai/dress-code/raw/master/eslint/.eslintignore | ||
``` | ||
|
||
## Customization | ||
|
||
Remember to add an env property detailing your target env, so that eslint will not raise unexistent errors. For example, for a browser library, you would add: | ||
|
||
```yaml | ||
env: | ||
browser: true | ||
``` | ||
## Tests | ||
Tests may follow different rules, and usually it would be enough to just add some overrides. There are some cases (like with mocha and jest) when you also need to set a specific env (which cannot be set in overrides). In this case, define a new `.eslintrc.yml` file in your `tests` folder. It will inherit the file in the root folder by default. For example: | ||
|
||
```yaml | ||
# tests/.eslintrc.yml | ||
env: | ||
jest: true | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
--- | ||
extends: airbnb-base | ||
rules: | ||
no-multi-spaces: 0 | ||
import/prefer-default-export: 0 | ||
no-unused-vars: | ||
- error | ||
- argsIgnorePattern: '^_.+' | ||
varsIgnorePattern: '^_.+' | ||
no-constant-condition: | ||
- error | ||
- checkLoops: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
--- | ||
extends: airbnb | ||
rules: | ||
no-multi-spaces: 0 | ||
import/prefer-default-export: 0 | ||
no-unused-vars: | ||
- error | ||
- argsIgnorePattern: '^_.+' | ||
varsIgnorePattern: '^_.+' | ||
no-constant-condition: | ||
- error | ||
- checkLoops: false |