Skip to content

Commit 6e6e9fb

Browse files
committed
Merge pull request #1 from nutshellcrm/initial-commit
Create default linting rules
2 parents 3cdddec + 680c043 commit 6e6e9fb

File tree

14 files changed

+235
-1
lines changed

14 files changed

+235
-1
lines changed

.eslintrc

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
3+
extends: nutshell
4+
5+
ecmaFeatures:
6+
modules: false
7+
8+
env:
9+
node: true
10+
11+
rules:
12+
key-spacing:
13+
- 2
14+
- align: colon
15+
quote-props:
16+
- 2
17+
- always
18+
strict:
19+
- 2
20+
- global

.gitignore

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
node_modules/*
2+
!node_modules/eslint-config-nutshell
3+
4+
# Ignore configuration and automatically generated cruft
5+
*.log
6+
7+
# Operating system files
8+
.Spotlight-V100
9+
.Trashes
10+
.DS_Store
11+
.DS_Store?
12+
ehthumbs.db
13+
Thumbs.db
14+
15+
# Text Editors
16+
*.sublime-workspace

README.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,19 @@
11
# eslint-config-nutshell
2-
ESLint shareable config for the Nutshell JavaScript style guide
2+
ESLint [shareable config](http://eslint.org/docs/developer-guide/shareable-configs.html) for the Nutshell JavaScript style guide
3+
4+
5+
## Install
6+
7+
```
8+
$ npm install --save-dev eslint eslint-config-nutshell
9+
```
10+
11+
## Usage
12+
13+
Read up on how to use [sharable configs](http://eslint.org/docs/developer-guide/shareable-configs) at the ESLint website. Essentially, add the following to the project's `.eslintrc` file:
14+
15+
```json
16+
{
17+
"extends": "nutshell"
18+
}
19+
```

default.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
'use strict';
2+
3+
module.exports = {
4+
'extends': [
5+
'eslint:recommended',
6+
'eslint-config-nutshell/rules/babel',
7+
'eslint-config-nutshell/rules/best-practices',
8+
'eslint-config-nutshell/rules/errors',
9+
'eslint-config-nutshell/rules/es6',
10+
'eslint-config-nutshell/rules/react',
11+
'eslint-config-nutshell/rules/strict',
12+
'eslint-config-nutshell/rules/style',
13+
],
14+
};

index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
'use strict';
2+
3+
module.exports = require('./default');

node_modules/eslint-config-nutshell

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{
2+
"name": "eslint-config-nutshell",
3+
"version": "1.0.0",
4+
"description": "ESLint sharable config for Nutshell Javascript style guide",
5+
"main": "index.js",
6+
"scripts": {
7+
"test": "npm run lint -s",
8+
"lint": "eslint ."
9+
},
10+
"repository": {
11+
"type": "git",
12+
"url": "git+https://github.com/nutshellcrm/eslint-config-nutshell.git"
13+
},
14+
"keywords": [
15+
"nutshell",
16+
"eslint",
17+
"config",
18+
"eslintconfig"
19+
],
20+
"author": "Nutshell",
21+
"license": "UNLICENSED",
22+
"bugs": {
23+
"url": "https://github.com/nutshellcrm/eslint-config-nutshell/issues"
24+
},
25+
"homepage": "https://github.com/nutshellcrm/eslint-config-nutshell#readme",
26+
"peerDependencies": {
27+
"eslint": "^1.6.0",
28+
"eslint-plugin-babel": "^2.1.1",
29+
"eslint-plugin-react": "^3.8.0"
30+
},
31+
"devDependencies": {
32+
"babel-eslint": "^4.1.4",
33+
"eslint": ">=1.6.0",
34+
"eslint-plugin-babel": "^2.1.1",
35+
"eslint-plugin-react": "^3.8.0"
36+
}
37+
}

rules/babel.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
'use strict';
2+
3+
module.exports = {
4+
'parser' : 'babel-eslint',
5+
'plugins': ['babel'],
6+
'rules' : {
7+
// Use babel/new-cap instead of new-cap for decorator support
8+
'babel/new-cap': [2],
9+
},
10+
};

rules/best-practices.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
'use strict';
2+
3+
module.exports = {
4+
'rules': {
5+
// Specify curly brace conventions for all control statements
6+
'curly' : [2, 'multi-line'],
7+
// Disallow use of multiple spaces
8+
'no-multi-spaces' : [2],
9+
// Disallow reassignment of function parameters
10+
'no-param-reassign': [2],
11+
// Disallow comparisons where both sides are exactly the same
12+
'no-self-compare' : [2],
13+
// Disallow usage of expressions in statement position
14+
'no-throw-literal' : [2],
15+
},
16+
};

rules/errors.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
'use strict';
2+
3+
module.exports = {
4+
'rules': {
5+
// Enforce trailing commas in multiline object literals
6+
'comma-dangle': [2, 'always-multiline'],
7+
},
8+
};

0 commit comments

Comments
 (0)