-
Notifications
You must be signed in to change notification settings - Fork 111
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Copying ESLint config instead of linking. updating with wf-style rules
- Loading branch information
1 parent
54546f8
commit 82ebead
Showing
3 changed files
with
24 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ const CLIEngine = require('eslint').CLIEngine; | |
const temp = require('temp'); | ||
const fs = require('fs'); | ||
const merge = require('ramda').merge; | ||
const shell = require('shelljs'); | ||
const logger = require('./../logger'); | ||
const kytConfig = require('./../../config/kyt.config'); | ||
const baseConfig = require('./../../eslint.json'); | ||
|
@@ -41,25 +42,14 @@ module.exports = () => { | |
logger.log(formatter(report.results)); | ||
}; | ||
|
||
// In order to support merging a local configFile/eslint.json, | ||
// we need to save the result of the merge to a temp file | ||
// and point to that. Otherwise, we just use our config. | ||
if (kytConfig.eslintConfig) { | ||
const config = getConfig(kytConfig.eslintConfig); | ||
temp.open('temp-eslintrc-', (error, info) => { | ||
if (!error) { | ||
fs.write(info.fd, JSON.stringify(config)); | ||
fs.close(info.fd, logger.error); | ||
eslintCLI.configFile = info.path; | ||
lint(); | ||
temp.cleanupSync(); | ||
logger.info('Using eslint config override'); | ||
} else { | ||
logger.error('Error with user eslint config', error); | ||
} | ||
}); | ||
} else { | ||
eslintCLI.configFile = path.join(__dirname, '../../eslint.json'); | ||
const esLintPath = path.join(kytConfig.userRootPath, './eslint.json'); | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
tizmagik
Contributor
|
||
|
||
// Check to see if eslint file exists | ||
if (!shell.test('-f', esLintPath)) { | ||
logger.error('You do not have an esLint File'); | ||
logger.info('Run node_modules/.bin kyt setup to get the default eslint config'); | ||
process.exit(); | ||
} | ||
eslintCLI.configFile = esLintPath; | ||
lint(); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
You will also need to check for
eslintrc
and eslint settings in package.json and the other handful of ways to specify eslint settings.