Skip to content
This repository has been archived by the owner on Sep 27, 2023. It is now read-only.

Commit

Permalink
Merge pull request #1 from invisible-tech/rgo/bootstrap
Browse files Browse the repository at this point in the history
feat: bootstrap @invisible eslint plugin
  • Loading branch information
gunar authored Sep 26, 2017
2 parents 4036b62 + 6d60086 commit f5803e0
Show file tree
Hide file tree
Showing 13 changed files with 337 additions and 1,923 deletions.
77 changes: 1 addition & 76 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,78 +1,3 @@
{
"extends": [
"plugin:lodash-fp/recommended",
"airbnb/base"
],
"env": {
"node": true,
"mocha": true,
"es6": true
},
"plugins": [
"lodash-fp",
"promise"
],
"parserOptions": {
"sourceType": "script",
"ecmaVersion": 8
},
"rules": {
"array-bracket-spacing": "off",
"arrow-parens": ["error", "as-needed", { "requireForBlockBody": false }],
"brace-style": ["error", "1tbs", { "allowSingleLine": true }],
"consistent-return": "off",
"comma-dangle": ["error", {
"arrays": "always-multiline",
"objects": "always-multiline",
"imports": "always-multiline",
"exports": "always-multiline",
"functions": "ignore"
}],
"func-names": "off",
"generator-star-spacing": ["error", "after"],
"global-require": "off",
"guard-for-in": "off",
"import/no-dynamic-require": "off",
"import/no-extraneous-dependencies": "off",
"indent": ["error", 2, { "CallExpression": { "arguments": "first" }, "SwitchCase": 1 }],
"max-len": "off",
"newline-per-chained-call": "off",
"no-continue": "off",
"no-multiple-empty-lines": "off",
"no-param-reassign": ["error", {"props": false}],
"no-plusplus": ["error", { "allowForLoopAfterthoughts": true }],
"no-restricted-syntax": ["error", "ClassDeclaration"],
"no-underscore-dangle": "off",
"no-unused-vars": ["error", { "vars": "all", "args": "after-used" }],
"no-use-before-define": "off",
"one-var": ["error", { "uninitialized": "always", "initialized": "never" }],
"one-var-declaration-per-line": ["error", "initializations"],
"prefer-rest-params": "off",
"promise/always-return": "error",
"promise/catch-or-return": "error",
"promise/no-native": "off",
"promise/param-names": "error",
"require-yield": "off",
"semi": ["error", "never"],
"space-before-function-paren": ["error", {
"anonymous": "never",
"named": "never",
"asyncArrow": "always"
}],
"space-in-parens": "off",
"space-unary-ops": ["error", {
"words": true,
"nonwords": false,
"overrides": {
"!": true
}
}],
"strict": ["error", "global"],
"valid-jsdoc": "error"
},
"settings": {
"lodash": {
"pragma": "fp"
}
}
"extends": "./src/index.js"
}
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
8.1.4
8.5.0
19 changes: 19 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Copyright (c) 2017 Invisible Technologies

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
24 changes: 15 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,25 @@
# inv-lint
> Invisible Technologies Eslint Package
# @invisible/eslint-config
> Invisible Technologies Eslint Config
# Install

```
yarn add -D invisible-tech/inv-lint
yarn add -D @invisible/eslint-config
# or
npm install -D invisible-tech/inv-lint
npm install -D @invisible/eslint-config
```

# Usage

1. Add `inv-lint` to your lint script on `package.json`
```json
1. Add `"@invisible"` to `extends` on your `.eslintrc.json` file:
```json
// It should look something like:
"lint": "inv-lint",
"pretest": "yarn run lint",
```
{
"extends": "@invisible"
}
```

2. Add eslint as a devDependency:
```
yarn add -D eslint
```
7 changes: 3 additions & 4 deletions circle.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
dependencies:
pre:
- 'echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc'
override:
- yarn

Expand All @@ -13,7 +11,7 @@ machine:
NODE_ENV: test

node:
version: "8.4.0"
version: "8.5.0"

timezone: America/Los_Angeles

Expand All @@ -25,4 +23,5 @@ deployment:
release:
branch: master
commands:
- npm publish
- 'echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc'
- npm publish --access=public
52 changes: 23 additions & 29 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "inv-lint",
"license": "UNLICENSED",
"version": "0.0.1",
"description": "",
"name": "@invisible/eslint-config",
"license": "MIT",
"version": "1.0.0",
"description": "Invisible Rules",
"engines": {
"node": "^8.4.0"
"node": "^8.5.0"
},
"homepage": "",
"author": {
Expand All @@ -16,47 +16,41 @@
"src"
],
"main": "src/index.js",
"bin": {
"inv-lint": "src/index.js"
},
"keywords": [],
"keywords": [
"eslint",
"eslintplugin"
],
"devDependencies": {
"avow": "^4.0.3",
"docdash": "^0.4.0",
"dotenv": "^4.0.0",
"eslint": "^4.7.1",
"eslint-config-airbnb": "^15.1.0",
"eslint-formatter-pretty": "^1.3.0",
"eslint-plugin-import": "^2.7.0",
"eslint-plugin-jsx-a11y": "^6.0.2",
"eslint-plugin-lodash-fp": "^2.1.3",
"eslint-plugin-promise": "^3.5.0",
"eslint-plugin-react": "^7.3.0",
"jsdoc": "^3.5.4",
"lodash": "^4.17.4",
"mocha": "^3.5.3",
"mock-require": "^2.0.2",
"nsp": "^2.8.0",
"nyc": "^11.2.1",
"recursive-readdir": "^2.2.1",
"sinon": "^3.2.1",
"sinon-express-mock": "^1.3.1",
"yarn": "^0.27.5"
},
"repository": "[email protected]:invisible-tech/inv-lint.git",
"scripts": {
"builddoc": "./node_modules/.bin/jsdoc -c ./.jsdoc.json",
"coverage": "nyc report --reporter=lcov --reporter=html --reporter=text-summary --reporter=text",
"fix": "eslint --cache --fix scripts src test",
"lint": "eslint --cache -f node_modules/eslint-formatter-pretty scripts src test",
"postinstall": "scripts/postinstall.sh",
"prepublish": "nsp check",
"pretest": "yarn run lint",
"test": "yarn run test-only",
"test-only": "NODE_ENV=test nyc mocha $(find test -name '*.spec.js')"
"lint": "eslint --cache -f node_modules/eslint-formatter-pretty --ignore-path .gitignore .",
"test": "npm run lint",
"prepublish": "nsp check"
},
"dependencies": {
"cross-spawn": "^5.1.0",
"eslint": "^4.6.1",
"eslint-config-airbnb": "^15.1.0",
"eslint-formatter-list": "^1.0.0",
"eslint-formatter-pretty": "^1.3.0",
"eslint-plugin-import": "^2.7.0",
"eslint-plugin-jsx-a11y": "^6.0.2",
"eslint-plugin-lodash-fp": "^2.1.3",
"eslint-plugin-promise": "^3.5.0",
"eslint-plugin-react": "^7.3.0"
},
"peerDependencies": {
"eslint": ">=4.7.1"
}
}
14 changes: 0 additions & 14 deletions scripts/postinstall.sh

This file was deleted.

93 changes: 79 additions & 14 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,82 @@
#!/usr/bin/env node

'use strict'

const spawn = require('cross-spawn')

const cwd = process.cwd()

const configFilePath = `${cwd}/node_modules/inv-lint/.eslintrc.json`
const outputFormatPath = `${cwd}/node_modules/eslint-formatter-pretty`
const filesPath = [`${cwd}/scripts`, `${cwd}/src`, `${cwd}/test`, '--ignore-path', `${cwd}/.gitignore`]

const eslintCommand = ['-c', configFilePath, '--cache', '-f', outputFormatPath, ...filesPath]
const fixCommand = ['-c', configFilePath, '--cache', '--fix', ...filesPath]
/* eslint-disable quote-props */

spawn.sync('eslint', eslintCommand, { stdio: 'inherit' })
spawn.sync('eslint', fixCommand, { stdio: 'inherit' })
module.exports = {
extends: [
'plugin:lodash-fp/recommended',
'airbnb/base',
],
env: {
node: true,
mocha: true,
es6: true,
},
plugins: [
'lodash-fp',
'promise',
],
parserOptions: {
sourceType: 'script',
ecmaVersion: 8,
},
settings: {
lodash: {
pragma: 'fp',
},
},
rules: {
'array-bracket-spacing': 'off',
'arrow-parens': ['error', 'as-needed', { requireForBlockBody: false }],
'brace-style': ['error', '1tbs', { allowSingleLine: true }],
'consistent-return': 'off',
'comma-dangle': ['error', {
arrays: 'always-multiline',
objects: 'always-multiline',
imports: 'always-multiline',
exports: 'always-multiline',
functions: 'ignore',
}],
'func-names': 'off',
'generator-star-spacing': ['error', 'after'],
'global-require': 'off',
'guard-for-in': 'off',
'import/no-dynamic-require': 'off',
'import/no-extraneous-dependencies': 'off',
'indent': ['error', 2, { CallExpression: { arguments: 'first' }, SwitchCase: 1 }],
'max-len': 'off',
'newline-per-chained-call': 'off',
'no-continue': 'off',
'no-multiple-empty-lines': 'off',
'no-param-reassign': ['error', { props: false }],
'no-plusplus': ['error', { allowForLoopAfterthoughts: true }],
'no-restricted-syntax': ['error', 'ClassDeclaration'],
'no-underscore-dangle': 'off',
'no-unused-vars': ['error', { vars: 'all', args: 'after-used' }],
'no-use-before-define': 'off',
'one-var': ['error', { uninitialized: 'always', initialized: 'never' }],
'one-var-declaration-per-line': ['error', 'initializations'],
'prefer-rest-params': 'off',
'promise/always-return': 'error',
'promise/catch-or-return': 'error',
'promise/no-native': 'off',
'promise/param-names': 'error',
'require-yield': 'off',
'semi': ['error', 'never'],
'space-before-function-paren': ['error', {
anonymous: 'never',
named: 'never',
asyncArrow: 'always',
}],
'space-in-parens': 'off',
'space-unary-ops': ['error', {
words: true,
nonwords: false,
overrides: {
'!': true,
},
}],
'strict': ['error', 'global'],
'valid-jsdoc': 'error',
},
}
4 changes: 0 additions & 4 deletions test/helpers/loadEnv.js

This file was deleted.

8 changes: 0 additions & 8 deletions test/mocha.opts

This file was deleted.

17 changes: 0 additions & 17 deletions test/specs/env.spec.js

This file was deleted.

8 changes: 0 additions & 8 deletions test/testHelper.js

This file was deleted.

Loading

0 comments on commit f5803e0

Please sign in to comment.