Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade eslint & related packages #116

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ yarn add --dev prettier-standard

Prettier-standard is best used with `prettier-standard --lint` command which formats and lints all non-ignored files in repository. Here's full usage:


```
Usage
$ prettier-standard [<glob>]
Expand Down Expand Up @@ -134,11 +133,10 @@ You can also configure linting by creating appropriate [.eslintrc]() file that w
}
```


Prettier-standard includes following packages so you don't need to install them in your repository:

- eslint
- babel-eslint
- @babel/eslint-parser
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

babel-eslint was deprecated 6 months ago

- eslint-config-prettier
- eslint-config-standard
- eslint-config-standard-jsx
Expand All @@ -150,11 +148,9 @@ Prettier-standard includes following packages so you don't need to install them
- eslint-plugin-promise
- eslint-plugin-react
- eslint-plugin-react-hooks
- eslint-plugin-standard
- @typescript-eslint/eslint-plugin
- @typescript-eslint/parser


### Ignoring Files

You can use `.prettierignore` file for ignoring any files to format, e.g:
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "prettier-standard",
"version": "16.4.1",
"version": "16.5.0",
"description": "Prettier and standard brought together!",
"main": "src/index.js",
"bin": {
Expand All @@ -22,7 +22,7 @@
"dependencies": {
"chalk": "^2.4.2",
"diff": "^4.0.2",
"eslint": "^6.8.0",
"eslint": "^7.23.0",
"execa": "^2.0.4",
"find-up": "^4.1.0",
"get-stdin": "^7.0.0",
Expand Down
14 changes: 5 additions & 9 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ async function run (cwd, config) {

if (config.lint) {
const eslintPath = getPathInHostNodeModules('eslint')
const babelEslintPath = getPathInHostNodeModules('babel-eslint')
const babelEslintPath = getPathInHostNodeModules('@babel/eslint-parser')

const configs = {
prettier: getPathInHostNodeModules('eslint-config-prettier'),
Expand All @@ -122,6 +122,9 @@ async function run (cwd, config) {
const eslint = require(eslintPath)
engine = new eslint.CLIEngine({
parser: babelEslintPath,
parserOptions: {
requireConfigFile: false
},
Comment on lines +125 to +127
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This solves the babel parsing error that throws for each file after upgrading to @babel/eslint-parser:

./prettier-standard/src/cli.js
  0:0  error  Parsing error: No Babel config file detected for ./prettier-standard/src/cli.js. Either disable config file checking with requireConfigFile: false, or configure Babel so that it can find the config files

./prettier-standard/src/index.js
  0:0  error  Parsing error: No Babel config file detected for ./prettier-standard/src/index.js. Either disable config file checking with requireConfigFile: false, or configure Babel so that it can find the config files

./prettier-standard/src/scms/git.js
  0:0  error  Parsing error: No Babel config file detected for ./prettier-standard/src/scms/git.js. Either disable config file checking with requireConfigFile: false, or configure Babel so that it can find the config files

./prettier-standard/src/utils.js
  0:0  error  Parsing error: No Babel config file detected for ./prettier-standard/src/utils.js. Either disable config file checking with requireConfigFile: false, or configure Babel so that it can find the config files

./prettier-standard/test/cli.test.js
  0:0  error  Parsing error: No Babel config file detected for ./prettier-standard/test/cli.test.js. Either disable config file checking with requireConfigFile: false, or configure Babel so that it can find the config files

./prettier-standard/test/index.test.js
  0:0  error  Parsing error: No Babel config file detected for ./prettier-standard/test/index.test.js. Either disable config file checking with requireConfigFile: false, or configure Babel so that it can find the config files

resolvePluginsRelativeTo: path.join(__dirname, 'vendor'),
baseConfig: {
plugins: ['jest'],
Expand All @@ -131,14 +134,7 @@ async function run (cwd, config) {
extends: [
getConfig('standard', 'index.js'),
getConfig('standard-jsx', 'index.js'),
getConfig('prettier', 'index.js'),
getConfig('prettier', '@typescript-eslint.js'),
getConfig('prettier', 'babel.js'),
getConfig('prettier', 'flowtype.js'),
getConfig('prettier', 'react.js'),
getConfig('prettier', 'standard.js'),
getConfig('prettier', 'unicorn.js'),
getConfig('prettier', 'vue.js')
Comment on lines -134 to -141
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This addresses the breaking changes from v8.0.0 of eslint-config-prettier

getConfig('prettier', 'index.js')
]
}
})
Expand Down
17 changes: 8 additions & 9 deletions src/vendor/package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
{
"dependencies": {
"babel-eslint": "^10.1.0",
"eslint-config-prettier": "~6.11.0",
"eslint-config-standard": "14.1.1",
"eslint-config-standard-jsx": "8.1.0",
"eslint-plugin-import": "~2.20.2",
"eslint-plugin-jest": "~23.8.2",
"@babel/eslint-parser": "^7.13.14",
"eslint-config-prettier": "~8.1.0",
"eslint-config-standard": "16.0.2",
"eslint-config-standard-jsx": "10.0.0",
"eslint-plugin-import": "~2.22.1",
"eslint-plugin-jest": "~24.3.2",
"eslint-plugin-node": "~11.1.0",
"eslint-plugin-promise": "~4.2.1",
"eslint-plugin-react": "~7.19.0",
"eslint-plugin-standard": "~4.0.1"
"eslint-plugin-promise": "~4.3.1",
"eslint-plugin-react": "~7.23.1"
}
}
Loading