Skip to content

Commit

Permalink
feat: add config
Browse files Browse the repository at this point in the history
  • Loading branch information
dackmin committed May 14, 2020
1 parent c232e94 commit d6f74c4
Show file tree
Hide file tree
Showing 9 changed files with 1,720 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[*]
indent_size=2
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,5 @@ dist

# TernJS port file
.tern-port

.DS_Store
25 changes: 25 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Poool ESLint Config

> Common ESLint rules we share between projects at Poool
## Installation

```bash
yarn add @poool/eslint-config --dev
npx install-peerdeps -Y @poool/eslint-config
```

## Usage

```json
extends: ["@poool"]
```

Available subconfigs:
- `common`
- `frontend`
- `backend`

```json
extends: ["@poool/frontend"]
```
10 changes: 10 additions & 0 deletions backend.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
const OFF = 0;
const WARNING = 1;
const ERROR = 2;

module.exports = {
extends: [require.resolve('./common')],
env: {
node: true,
},
};
42 changes: 42 additions & 0 deletions common.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
const OFF = 0;
const WARNING = 1;
const ERROR = 2;

module.exports = {
extends: ['eslint:recommended', 'standard'],
parser: 'babel-eslint',
parserOptions: {
ecmaVersion: 2020,
sourceType: 'module',
},
plugins: [
'babel',
],
rules: {
'comma-dangle': [WARNING, {
'arrays': 'always-multiline',
'objects': 'always-multiline',
'imports': 'always-multiline',
'exports': 'always-multiline',
'functions': 'ignore',
}],
'semi': [ERROR, 'always'],
'no-unused-vars': [WARNING, {
varsIgnorePattern: '^_',
argsIgnorePattern: '.+',
}],
'no-multiple-empty-lines': WARNING,
'eol-last': OFF,
'no-trailing-spaces': [WARNING, { skipBlankLines: true }],
'no-console': [WARNING, {
allow: ['warn', 'error', 'time', 'timeEnd', 'timeStamp'],
}],
'padded-blocks': OFF,
'spaced-comment': OFF,
'space-before-function-paren': WARNING,
'new-cap': OFF,
'max-len': WARNING,
'object-curly-newline': OFF,
'object-property-newline': OFF
},
};
22 changes: 22 additions & 0 deletions frontend.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
const OFF = 0;
const WARNING = 1;
const ERROR = 2;

module.exports = {
env: {
browser: true,
},
extends: [require.resolve('./common'), 'plugin:react/recommended'],
parser: 'babel-eslint',
parserOptions: {
ecmaVersion: 2020,
sourceType: 'module',
ecmaFeatures: {
jsx: true,
},
},
plugins: [
'babel',
'react',
],
};
11 changes: 11 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const OFF = 0;
const WARNING = 1;
const ERROR = 2;

module.exports = {
extends: [
'./common',
'./node',
'./browser',
].map(require.resolve),
};
31 changes: 31 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"name": "@poool/eslint-config",
"version": "0.0.1-alpha.1",
"description": "Common ESLint rules we share between projects at Poool",
"main": "index.js",
"repository": "https://github.com/p3ol/eslint-config.git",
"author": "Ugo Stephant <ugo@poool.fr>",
"license": "MIT",
"peerDependencies": {
"babel-eslint": ">=10",
"eslint": ">=6",
"eslint-config-standard": ">=14",
"eslint-plugin-babel": ">=5",
"eslint-plugin-import": ">=2",
"eslint-plugin-node": ">=11",
"eslint-plugin-promise": ">=4",
"eslint-plugin-react": ">=7",
"eslint-plugin-standard": ">=4"
},
"devDependencies": {
"babel-eslint": "10.1.0",
"eslint": "6.8.0",
"eslint-config-standard": "14.1.1",
"eslint-plugin-babel": "5.3.0",
"eslint-plugin-import": "2.20.2",
"eslint-plugin-node": "11.1.0",
"eslint-plugin-promise": "4.2.1",
"eslint-plugin-react": "7.20.0",
"eslint-plugin-standard": "4.0.1"
}
}
Loading

0 comments on commit d6f74c4

Please sign in to comment.