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

Commit

Permalink
chore: initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigo4244 committed Sep 13, 2017
1 parent 886b96d commit 03cffc8
Show file tree
Hide file tree
Showing 8 changed files with 3,887 additions and 1 deletion.
1 change: 0 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
"max-len": "off",
"newline-per-chained-call": "off",
"no-continue": "off",
"no-multiple-empty-lines": "error",
"no-multiple-empty-lines": "off",
"no-param-reassign": ["error", {"props": false}],
"no-plusplus": ["error", { "allowForLoopAfterthoughts": true }],
Expand Down
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# inv-lint

# Setup

1. Add `WEBHOOK_PATH` environmental variable to your project on circleCI.

To do this you will have to:

- Go to `https://circleci.com/gh/invisible-tech/<your-project-name>/edit#env-vars` (replace \<your-project-name\>, e.g. gear)
- Click on `Import Variable(s)`.
- Select `WEBHOOK_PATH`.
- If you don't have permission to do that, ask your superior to do it!
62 changes: 62 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{
"name": "inv-lint",
"license": "UNLICENSED",
"version": "0.0.1",
"description": "",
"engines": {
"node": "^8.4.0"
},
"homepage": "",
"author": {
"email": "[email protected]",
"name": "Invisible Technologies",
"url": "https://github.com/invisible-tech"
},
"files": [
"src"
],
"main": "src/index.js",
"bin": {
"inv-lint": "src/index.js"
},
"keywords": [],
"devDependencies": {
"avow": "^4.0.3",
"docdash": "^0.4.0",
"dotenv": "^4.0.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')"
},
"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"
}
}
17 changes: 17 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/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]

spawn.sync('eslint', eslintCommand, { stdio: 'inherit' })
spawn.sync('eslint', fixCommand, { stdio: 'inherit' })
4 changes: 4 additions & 0 deletions test/helpers/loadEnv.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
'use strict'

process.env.NODE_ENV = 'test'
require('dotenv').config({ path: `${__dirname}/../../.env` })
17 changes: 17 additions & 0 deletions test/specs/env.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
'use strict'

const avow = require('avow')
const { forEach } = require('lodash/fp')

const envVars = [
'LOGGER_LEVEL',
'NODE_ENV',
]

describe('envVars', () => {
forEach(name => {
it(name, () => {
avow.notEqual(process.env[name], null, `${name} is not set`)
})
})(envVars)
})
8 changes: 8 additions & 0 deletions test/testHelper.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
'use strict'

/**
* This file exists to make requires easier for all our test files.
* We might need to move around dependent modules, and this allows us to make
* the change in one place.
*/
require('~/test/helpers/loadEnv')
Loading

0 comments on commit 03cffc8

Please sign in to comment.