Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicola Racco committed Aug 22, 2017
0 parents commit be571a3
Show file tree
Hide file tree
Showing 6 changed files with 100 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .editorconfig
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
21 changes: 21 additions & 0 deletions README.md
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/).
1 change: 1 addition & 0 deletions eslint/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
**/node_modules
40 changes: 40 additions & 0 deletions eslint/README.md
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
```
12 changes: 12 additions & 0 deletions eslint/js.eslintrc.yml
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
12 changes: 12 additions & 0 deletions eslint/jsx.eslintrc.yml
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

0 comments on commit be571a3

Please sign in to comment.