Skip to content

Commit

Permalink
fix(compat): Fix issues with node@^0.10
Browse files Browse the repository at this point in the history
  • Loading branch information
Kent C. Dodds committed Mar 16, 2016
1 parent f99a04c commit 7055b70
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 9 deletions.
4 changes: 4 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules/
coverage/
.nyc_output/

4 changes: 0 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ notifications:
email: false
node_js:
- '4'
- iojs-v3
- iojs-v2
- iojs-v1
- '0.12'
- '0.10'
before_install:
- npm i -g npm@^3.0.0
Expand Down
5 changes: 3 additions & 2 deletions bin.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
// Prints rules recognized by ESLint that don't appear in the given config
// preset. It helps with upgrading the preset when new ESLint gets released.
var path = require('path')
var findNewRules = require('.')
var isAbsolute = require('path-is-absolute')
var findNewRules = require('./index')

var currentRules = Object.keys(getConfig().rules)
var newRules = findNewRules(currentRules)
Expand All @@ -19,7 +20,7 @@ function getConfig() {
var specifiedFile = process.argv[2]
if (specifiedFile) {
// this is being called like: eslint-find-new-rules eslint-config-mgol
if (path.isAbsolute(specifiedFile)) {
if (isAbsolute(specifiedFile)) {
return require(specifiedFile)
} else {
return require(path.join(process.cwd(), specifiedFile))
Expand Down
4 changes: 3 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ module.exports = findNewRules
function findNewRules(currentRules) {
var allRules = fs
.readdirSync('./node_modules/eslint/lib/rules')
.map(filename => filename.replace(/\.js$/, ''))
.map(function removeJsFromFilename(filename) {
return filename.replace(/\.js$/, '')
})

return difference(allRules, currentRules)
}
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
],
"license": "MIT",
"dependencies": {
"lodash.difference": "4.1.1"
"lodash.difference": "4.1.1",
"path-is-absolute": "1.0.0"
},
"devDependencies": {
"ava": "0.13.0",
Expand Down
2 changes: 1 addition & 1 deletion test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import mock from 'mock-fs'
import test from 'ava'
import findNewRules from '.'
import findNewRules from './index'

try {
require('./bin') // requiring now for coverage until this is tested
Expand Down

0 comments on commit 7055b70

Please sign in to comment.