Skip to content

Commit

Permalink
fix: Bumped eslint, prettier-eslint to latest with updates (#97)
Browse files Browse the repository at this point in the history
* fix: Bumped eslint, prettier-eslint to latest with updates

Bumped eslint to 4.5.0 and prettier-eslint to 6.4.2. Updated eslint-config-kentcdodds to 12.4.2.
Added some changes to package.json to correct new formatting of error rules form eslint.  Imported
Config and Lint from eslint/lib to pass into the new ConfigFile.load(file, context)

fix: update to eslint 4.0 #94

* fix: Fixes after PR Review

Updates after PR Review to move const location

closes #94
  • Loading branch information
jmenglis authored and Kent C. Dodds committed Aug 30, 2017
1 parent 8ffe4ad commit 0238687
Show file tree
Hide file tree
Showing 7 changed files with 552 additions and 187 deletions.
12 changes: 12 additions & 0 deletions .all-contributorsrc
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,18 @@
"code",
"test"
]
},
{
"login": "jmenglis",
"name": "Josh English",
"avatar_url": "https://avatars3.githubusercontent.com/u/13577271?v=4",
"profile": "http://www.joshenglish.com",
"contributions": [
"test",
"bug",
"code",
"plugin"
]
}
]
}
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ CLI for [`prettier-eslint`][prettier-eslint]
[![downloads][downloads-badge]][npm-stat]
[![MIT License][license-badge]][LICENSE]

[![All Contributors](https://img.shields.io/badge/all_contributors-18-orange.svg?style=flat-square)](#contributors)
[![All Contributors](https://img.shields.io/badge/all_contributors-19-orange.svg?style=flat-square)](#contributors)
[![PRs Welcome][prs-badge]][prs]
[![Donate][donate-badge]][donate]
[![Code of Conduct][coc-badge]][coc]
Expand Down Expand Up @@ -243,7 +243,7 @@ Thanks goes to these people ([emoji key][emojis]):
| [<img src="https://avatars.githubusercontent.com/u/1500684?v=3" width="100px;"/><br /><sub>Kent C. Dodds</sub>](https://kentcdodds.com)<br />[💻](https://github.com/prettier/prettier-eslint-cli/commits?author=kentcdodds "Code") [📖](https://github.com/prettier/prettier-eslint-cli/commits?author=kentcdodds "Documentation") [🚇](#infra-kentcdodds "Infrastructure (Hosting, Build-Tools, etc)") [⚠️](https://github.com/prettier/prettier-eslint-cli/commits?author=kentcdodds "Tests") | [<img src="https://avatars3.githubusercontent.com/u/3266363?v=3" width="100px;"/><br /><sub>Adam Harris</sub>](https://github.com/aharris88)<br />[💻](https://github.com/prettier/prettier-eslint-cli/commits?author=aharris88 "Code") [📖](https://github.com/prettier/prettier-eslint-cli/commits?author=aharris88 "Documentation") [👀](#review-aharris88 "Reviewed Pull Requests") | [<img src="https://avatars.githubusercontent.com/u/622118?v=3" width="100px;"/><br /><sub>Eric McCormick</sub>](https://ericmccormick.io)<br />[👀](#review-edm00se "Reviewed Pull Requests") | [<img src="https://avatars.githubusercontent.com/u/12389411?v=3" width="100px;"/><br /><sub>Joel Sequeira</sub>](https://github.com/joelseq)<br />[📖](https://github.com/prettier/prettier-eslint-cli/commits?author=joelseq "Documentation") | [<img src="https://avatars.githubusercontent.com/u/103008?v=3" width="100px;"/><br /><sub>Frank Taillandier</sub>](https://frank.taillandier.me)<br /> | [<img src="https://avatars3.githubusercontent.com/u/292365?v=3" width="100px;"/><br /><sub>Adam Stankiewicz</sub>](http://sheerun.net)<br />[💻](https://github.com/prettier/prettier-eslint-cli/commits?author=sheerun "Code") | [<img src="https://avatars3.githubusercontent.com/u/487068?v=3" width="100px;"/><br /><sub>Stephen John Sorensen</sub>](http://www.stephenjohnsorensen.com/)<br />[💻](https://github.com/prettier/prettier-eslint-cli/commits?author=spudly "Code") |
| :---: | :---: | :---: | :---: | :---: | :---: | :---: |
| [<img src="https://avatars0.githubusercontent.com/u/11560964?v=3" width="100px;"/><br /><sub>Gandem</sub>](https://github.com/Gandem)<br />[💻](https://github.com/prettier/prettier-eslint-cli/commits?author=Gandem "Code") [⚠️](https://github.com/prettier/prettier-eslint-cli/commits?author=Gandem "Tests") | [<img src="https://avatars0.githubusercontent.com/u/129991?v=3" width="100px;"/><br /><sub>Matteo Ronchi</sub>](https://github.com/cef62)<br />[🐛](https://github.com/prettier/prettier-eslint-cli/issues?q=author%3Acef62 "Bug reports") [💻](https://github.com/prettier/prettier-eslint-cli/commits?author=cef62 "Code") | [<img src="https://avatars2.githubusercontent.com/u/61787?v=3" width="100px;"/><br /><sub>Benoît Zugmeyer</sub>](https://github.com/BenoitZugmeyer)<br />[💻](https://github.com/prettier/prettier-eslint-cli/commits?author=BenoitZugmeyer "Code") [⚠️](https://github.com/prettier/prettier-eslint-cli/commits?author=BenoitZugmeyer "Tests") | [<img src="https://avatars0.githubusercontent.com/u/5038030?v=3" width="100px;"/><br /><sub>Charlike Mike Reagent</sub>](https://i.am.charlike.online)<br />[💻](https://github.com/prettier/prettier-eslint-cli/commits?author=tunnckoCore "Code") [⚠️](https://github.com/prettier/prettier-eslint-cli/commits?author=tunnckoCore "Tests") | [<img src="https://avatars0.githubusercontent.com/u/10954870?v=3" width="100px;"/><br /><sub>Dion Dirza</sub>](https://github.com/diondirza)<br />[🐛](https://github.com/prettier/prettier-eslint-cli/issues?q=author%3Adiondirza "Bug reports") | [<img src="https://avatars0.githubusercontent.com/u/3297808?v=3" width="100px;"/><br /><sub>mrm007</sub>](https://github.com/mrm007)<br />[🐛](https://github.com/prettier/prettier-eslint-cli/issues?q=author%3Amrm007 "Bug reports") [💻](https://github.com/prettier/prettier-eslint-cli/commits?author=mrm007 "Code") | [<img src="https://avatars0.githubusercontent.com/u/193238?v=3" width="100px;"/><br /><sub>Jack Franklin</sub>](http://www.jackfranklin.co.uk)<br />[💻](https://github.com/prettier/prettier-eslint-cli/commits?author=jackfranklin "Code") |
| [<img src="https://avatars0.githubusercontent.com/u/17342435?v=3" width="100px;"/><br /><sub>Ryan Zimmerman</sub>](http://www.ryanzim.com)<br />[📖](https://github.com/prettier/prettier-eslint-cli/commits?author=RyanZim "Documentation") | [<img src="https://avatars3.githubusercontent.com/u/1186409?v=3" width="100px;"/><br /><sub>Paolo Moretti</sub>](http://stackoverflow.com/users/63011)<br />[🐛](https://github.com/prettier/prettier-eslint-cli/issues?q=author%3Amoretti "Bug reports") [💻](https://github.com/prettier/prettier-eslint-cli/commits?author=moretti "Code") [⚠️](https://github.com/prettier/prettier-eslint-cli/commits?author=moretti "Tests") | [<img src="https://avatars0.githubusercontent.com/u/6242574?v=3" width="100px;"/><br /><sub>bySabi Files</sub>](https://github.com/bySabi)<br />[📖](https://github.com/prettier/prettier-eslint-cli/commits?author=bySabi "Documentation") [🔧](#tool-bySabi "Tools") | [<img src="https://avatars1.githubusercontent.com/u/554231?v=4" width="100px;"/><br /><sub>Pavel Pertsev</sub>](http://morhetz.com)<br />[💻](https://github.com/prettier/prettier-eslint-cli/commits?author=morhetz "Code") |
| [<img src="https://avatars0.githubusercontent.com/u/17342435?v=3" width="100px;"/><br /><sub>Ryan Zimmerman</sub>](http://www.ryanzim.com)<br />[📖](https://github.com/prettier/prettier-eslint-cli/commits?author=RyanZim "Documentation") | [<img src="https://avatars3.githubusercontent.com/u/1186409?v=3" width="100px;"/><br /><sub>Paolo Moretti</sub>](http://stackoverflow.com/users/63011)<br />[🐛](https://github.com/prettier/prettier-eslint-cli/issues?q=author%3Amoretti "Bug reports") [💻](https://github.com/prettier/prettier-eslint-cli/commits?author=moretti "Code") [⚠️](https://github.com/prettier/prettier-eslint-cli/commits?author=moretti "Tests") | [<img src="https://avatars0.githubusercontent.com/u/6242574?v=3" width="100px;"/><br /><sub>bySabi Files</sub>](https://github.com/bySabi)<br />[📖](https://github.com/prettier/prettier-eslint-cli/commits?author=bySabi "Documentation") [🔧](#tool-bySabi "Tools") | [<img src="https://avatars1.githubusercontent.com/u/554231?v=4" width="100px;"/><br /><sub>Pavel Pertsev</sub>](http://morhetz.com)<br />[💻](https://github.com/prettier/prettier-eslint-cli/commits?author=morhetz "Code") [⚠️](https://github.com/prettier/prettier-eslint-cli/commits?author=morhetz "Tests") | [<img src="https://avatars3.githubusercontent.com/u/13577271?v=4" width="100px;"/><br /><sub>Josh English</sub>](http://www.joshenglish.com)<br />[⚠️](https://github.com/prettier/prettier-eslint-cli/commits?author=jmenglis "Tests") [🐛](https://github.com/prettier/prettier-eslint-cli/issues?q=author%3Ajmenglis "Bug reports") [💻](https://github.com/prettier/prettier-eslint-cli/commits?author=jmenglis "Code") [🔌](#plugin-jmenglis "Plugin/utility libraries") |
<!-- ALL-CONTRIBUTORS-LIST:END -->

This project follows the [all-contributors][all-contributors] specification. Contributions of any kind welcome!
Expand Down
12 changes: 6 additions & 6 deletions cli-test/tests/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const BABEL_BIN_PATH = require.resolve('babel-cli/bin/babel-node')

testOutput('--version')

test('help outputs usage information and flags', async () => {
test('help outputs usage information and flags', async() => {
// can't just do the testOutput function here because
// the output is variable (based on the width of your
// terminal I think)...
Expand All @@ -39,7 +39,7 @@ test('help outputs usage information and flags', async () => {
}
})

test('formats files and outputs to stdout', async () => {
test('formats files and outputs to stdout', async() => {
// can't just do the testOutput function here because
// the output is in an undeterministic order
const stdout = await runPrettierESLintCLI(
Expand Down Expand Up @@ -71,7 +71,7 @@ test('formats files and outputs to stdout', async () => {
)
})

test('list different files with the --list-different option', async () => {
test('list different files with the --list-different option', async() => {
// can't just do the testOutput function here because
// the output is in an undeterministic order
const stdout = await runPrettierESLintCLI(
Expand All @@ -81,15 +81,15 @@ test('list different files with the --list-different option', async () => {
expect(stdout).toContain('cli-test/fixtures/stdout2.js')
})

test('accepts stdin of code', async () => {
test('accepts stdin of code', async() => {
const stdin = 'echo "console.log( window.baz , typeof [] ); "'
const stdout = await runPrettierESLintCLI('--stdin', stdin)
expect(stdout).toEqual('console.log(window.baz, typeof [])\n')
})

const writeCommand = 'cli-test/fixtures/example*.js --write --no-eslint-ignore'

test(`prettier-eslint ${writeCommand}`, async () => {
test(`prettier-eslint ${writeCommand}`, async() => {
// because we're using --write,
// we have to recreate and delete the files every time
const example1Path = path.resolve(__dirname, '../fixtures/example1.js')
Expand Down Expand Up @@ -120,7 +120,7 @@ test(`prettier-eslint ${writeCommand}`, async () => {
})

function testOutput(command) {
test(`prettier-eslint ${command}`, async () => {
test(`prettier-eslint ${command}`, async() => {
try {
const stdout = await runPrettierESLintCLI(command)
expect(stdout).toMatchSnapshot(`stdout: ${command}`)
Expand Down
19 changes: 16 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"camelcase-keys": "^4.1.0",
"chalk": "^1.1.3",
"common-tags": "^1.4.0",
"eslint": "^3.19.0",
"eslint": "^4.5.0",
"find-up": "^2.1.0",
"get-stdin": "^5.0.1",
"glob": "^7.1.1",
Expand All @@ -37,7 +37,7 @@
"lodash.memoize": "^4.1.2",
"loglevel-colored-level-prefix": "^1.0.0",
"messageformat": "^1.0.2",
"prettier-eslint": "^6.0.0",
"prettier-eslint": "^6.4.2",
"rxjs": "^5.3.0",
"yargs": "^7.1.0"
},
Expand All @@ -52,7 +52,7 @@
"codecov": "^2.1.0",
"commitizen": "^2.9.6",
"cz-conventional-changelog": "^2.0.0",
"eslint-config-kentcdodds": "^12.2.1",
"eslint-config-kentcdodds": "^12.4.2",
"husky": "^0.13.3",
"jest-cli": "^19.0.2",
"nps": "^5.1.0",
Expand All @@ -75,6 +75,19 @@
"max-len": [
2,
80
],
"import/max-dependencies": [
"error", {
"max": 16
}
],
"semi": [
"error",
"never"
],
"object-curly-spacing": [
"error",
"never"
]
}
},
Expand Down
6 changes: 5 additions & 1 deletion src/format-files.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import memoize from 'lodash.memoize'
import indentString from 'indent-string'
import getLogger from 'loglevel-colored-level-prefix'
import ConfigFile from 'eslint/lib/config/config-file'
import Linter from 'eslint/lib/linter'
import Config from 'eslint/lib/config'
import * as messages from './messages'

const LINE_SEPERATOR_REGEX = /(\r|\n|\r\n)/
Expand Down Expand Up @@ -51,7 +53,9 @@ function formatFilesFromArgv({
}

if (eslintConfigPath) {
prettierESLintOptions.eslintConfig = ConfigFile.load(eslintConfigPath)
const configContext = new Config({}, new Linter())
prettierESLintOptions.eslintConfig =
ConfigFile.load(eslintConfigPath, configContext)
}

const cliOptions = {write, listDifferent}
Expand Down
Loading

0 comments on commit 0238687

Please sign in to comment.