Skip to content

Commit f53a7b7

Browse files
committed
Initialize project
0 parents  commit f53a7b7

File tree

10 files changed

+243
-0
lines changed

10 files changed

+243
-0
lines changed

.editorconfig

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# http://editorconfig.org
2+
root = true
3+
4+
[*]
5+
charset = utf-8
6+
end_of_line = lf
7+
indent_size = 2
8+
indent_style = space
9+
insert_final_newline = true
10+
max_line_length = 80
11+
trim_trailing_whitespace = true
12+
13+
[*.md]
14+
max_line_length = 0
15+
trim_trailing_whitespace = false
16+
17+
[COMMIT_EDITMSG]
18+
max_line_length = 0

.eslintrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": "./index.js"
3+
}

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* text=auto

.gitignore

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# OS X
2+
.DS_Store*
3+
Icon?
4+
._*
5+
6+
# Windows
7+
Thumbs.db
8+
ehthumbs.db
9+
Desktop.ini
10+
11+
# Linux
12+
.directory
13+
*~
14+
15+
# Logs
16+
logs
17+
*.log
18+
npm-debug.log*
19+
20+
# Runtime data
21+
pids
22+
*.pid
23+
*.seed
24+
*.pid.lock
25+
26+
# Coverage directory used by tools like istanbul
27+
coverage
28+
29+
# Compiled binary addons (http://nodejs.org/api/addons.html)
30+
build/Release
31+
32+
# Dependency directories
33+
node_modules
34+
35+
# Optional npm cache directory
36+
.npm
37+
38+
# Optional eslint cache
39+
.eslintcache
40+
41+
# Optional REPL history
42+
.node_repl_history
43+
44+
# Output of 'npm pack'
45+
*.tgz
46+
*.gz
47+
48+
# Sauce Labs credentials
49+
sauce.json

.travis.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
sudo: false
2+
language: node_js
3+
node_js:
4+
- '6.0'
5+
- node
6+
script: npm test

LICENSE

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
Open Source Initiative OSI - The MIT License
2+
3+
Copyright (c) 2016-2017 Thomas Prelot
4+
5+
Permission is hereby granted, free of charge, to any person obtaining
6+
a copy of this software and associated documentation files (the
7+
"Software"), to deal in the Software without restriction, including
8+
without limitation the rights to use, copy, modify, merge, publish,
9+
distribute, sublicense, and/or sell copies of the Software, and to
10+
permit persons to whom the Software is furnished to do so, subject to
11+
the following conditions:
12+
13+
The above copyright notice and this permission notice shall be
14+
included in all copies or substantial portions of the Software.
15+
16+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

README.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# @gnodi/lint
2+
3+
[Node.js] Lint your code like gnodi !
4+
5+
[![Build Status][travis-image]][travis-url]
6+
7+
## Installation
8+
9+
Run the following command to add the package to your dev dependencies:
10+
```sh
11+
$ npm install --save-dev @gnodi/eslint-config
12+
```
13+
14+
## Use
15+
16+
### Use gnodi lint helper script
17+
18+
Add the following line to your `package.json`:
19+
```json
20+
...
21+
"scripts": {
22+
...
23+
"lint": "gnodi-lint"
24+
}
25+
...
26+
```
27+
28+
Then, you can immediately run the lint:
29+
```sh
30+
$ npm run lint
31+
```
32+
33+
### Override with custom rules
34+
35+
You can override some [rules](http://eslint.org/docs/rules/) with your own ones just using a standard `.eslintrc`:
36+
```json
37+
{
38+
"extends": "@gnodi",
39+
"rules": {
40+
"comma-dangle": ["error", "always"]
41+
}
42+
}
43+
```
44+
45+
### LICENSE
46+
47+
[MIT](LICENSE)
48+
49+
[travis-image]: https://img.shields.io/travis/gnodi/eslint-config.svg?style=flat
50+
[travis-url]: https://travis-ci.org/gnodi/eslint-config

bin/gnodi-lint.js

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#! /usr/bin/env node
2+
3+
'use strict';
4+
5+
const fs = require('fs');
6+
const path = require('path');
7+
const spawn = require('child_process').spawn;
8+
9+
const cwd = process.cwd();
10+
let configFilePath = path.join(cwd, '.eslintrc');
11+
12+
try {
13+
fs.accessSync(configFilePath);
14+
} catch (error) {
15+
configFilePath = path.join(__dirname, '..', '.eslintrc');
16+
}
17+
18+
/**
19+
* @todo think about using ignore file on eslint v4 release
20+
* @see https://github.com/eslint/eslint/issues/6759
21+
*/
22+
const rootPath = path.join(cwd, '*.js');
23+
const binPath = path.join(cwd, 'bin');
24+
const configPath = path.join(cwd, 'config');
25+
const libPath = path.join(cwd, 'lib');
26+
const srcPath = path.join(cwd, 'src');
27+
const testPath = path.join(cwd, 'test');
28+
29+
spawn(
30+
'npm',
31+
[
32+
'run', 'lint', '--',
33+
'--color',
34+
'--config', configFilePath,
35+
rootPath, binPath, configPath, libPath, srcPath, testPath
36+
],
37+
{
38+
cwd: path.join(__dirname, '..'),
39+
stdio: 'inherit'
40+
}
41+
);

index.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
'use strict';
2+
3+
module.exports = {
4+
extends: 'airbnb-base',
5+
env: {
6+
browser: true,
7+
node: true
8+
},
9+
parserOptions: {
10+
sourceType: 'script'
11+
},
12+
rules: {
13+
'comma-dangle': ['error', 'never']
14+
}
15+
};

package.json

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"name": "@gnodi/eslint-config",
3+
"description": "[Node.js] Lint your code like gnodi's one",
4+
"version": "0.0.0",
5+
"author": "Thomas Prelot <tprelot@gmail.com> (https://github.com/Gnucki)",
6+
"contributors": [],
7+
"keywords": [
8+
"gnodi",
9+
"lint",
10+
"eslint"
11+
],
12+
"dependencies": {
13+
"eslint": "^3.8.1",
14+
"eslint-config-airbnb-base": "^9.0.0",
15+
"eslint-config-standard": "^6.2.0",
16+
"eslint-plugin-import": "^2.0.1",
17+
"eslint-plugin-promise": "^3.3.0",
18+
"eslint-plugin-standard": "^2.0.1"
19+
},
20+
"devDependencies": {},
21+
"license": "MIT",
22+
"repository": {
23+
"type": "git",
24+
"url": "https://github.com/gnodi/eslint-config"
25+
},
26+
"main": "index",
27+
"scripts": {
28+
"lint": "eslint",
29+
"test": "eslint **/*.js"
30+
},
31+
"bin": {
32+
"gnodi-lint": "bin/gnodi-lint.js"
33+
},
34+
"engines": {
35+
"node": ">=6",
36+
"npm": ">=3"
37+
}
38+
}

0 commit comments

Comments
 (0)