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

prettier and eslint configs conflict and break tests #515

Closed
asprouse opened this issue Jun 14, 2019 · 2 comments · Fixed by #518
Closed

prettier and eslint configs conflict and break tests #515

asprouse opened this issue Jun 14, 2019 · 2 comments · Fixed by #518

Comments

@asprouse
Copy link
Contributor

asprouse commented Jun 14, 2019

This is a Bug Report

Description

Prettier has the bracketSpacing: false while eslint expects spacing around brackets for example right after committing code if I run eslint again I get these errors:

$ npm run eslint

> [email protected] eslint /Users/als/code/serverless-webpack
> node node_modules/eslint/bin/eslint.js --ext .js lib


/Users/als/code/serverless-webpack/lib/packagers/yarn.js
   31:18  error  A space is required after '['   array-bracket-spacing
   31:76  error  A space is required before ']'  array-bracket-spacing
   60:38  error  A space is required after '{'   object-curly-spacing
   60:57  error  A space is required before '}'  object-curly-spacing
  128:18  error  A space is required after '['   array-bracket-spacing
  128:70  error  A space is required before ']'  array-bracket-spacing
  135:46  error  A space is required after '{'   object-curly-spacing
  135:50  error  A space is required before '}'  object-curly-spacing
  146:20  error  A space is required after '['   array-bracket-spacing
  146:38  error  A space is required before ']'  array-bracket-spacing
  148:48  error  A space is required after '{'   object-curly-spacing
  148:52  error  A space is required before '}'  object-curly-spacing

/Users/als/code/serverless-webpack/lib/packagers/yarn.test.js
   50:52  error  A space is required after '{'                   object-curly-spacing
   50:77  error  A space is required before '}'                  object-curly-spacing
   56:1   error  Expected indentation of 8 spaces but found 10   indent
   57:1   error  Expected indentation of 10 spaces but found 12  indent
   58:1   error  Expected indentation of 10 spaces but found 12  indent
   58:13  error  A space is required after '['                   array-bracket-spacing
   58:59  error  A space is required before ']'                  array-bracket-spacing
   59:1   error  Expected indentation of 10 spaces but found 12  indent
   59:13  error  A space is required after '{'                   object-curly-spacing
   59:27  error  A space is required before '}'                  object-curly-spacing
   60:1   error  Expected indentation of 8 spaces but found 10   indent
  113:27  error  A space is required after '{'                   object-curly-spacing
  113:62  error  A space is required before '}'                  object-curly-spacing
  234:27  error  A space is required after '{'                   object-curly-spacing
  234:72  error  A space is required before '}'                  object-curly-spacing
  242:13  error  A space is required after '['                   array-bracket-spacing
  242:65  error  A space is required before ']'                  array-bracket-spacing
  254:27  error  A space is required after '{'                   object-curly-spacing
  254:72  error  A space is required before '}'                  object-curly-spacing
  257:38  error  A space is required after '{'                   object-curly-spacing
  257:58  error  A space is required before '}'                  object-curly-spacing
  303:27  error  A space is required after '{'                   object-curly-spacing
  303:57  error  A space is required before '}'                  object-curly-spacing
  306:41  error  A space is required after '['                   array-bracket-spacing
  306:52  error  A space is required before ']'                  array-bracket-spacing
  312:11  error  A space is required after '['                   array-bracket-spacing
  312:23  error  A space is required before ']'                  array-bracket-spacing
  319:11  error  A space is required after '['                   array-bracket-spacing
  319:23  error  A space is required before ']'                  array-bracket-spacing

/Users/als/code/serverless-webpack/lib/utils.js
  112:17  error  A space is required after '{'   object-curly-spacing
  112:32  error  A space is required before '}'  object-curly-spacing

✖ 43 problems (43 errors, 0 warnings)
  43 errors and 0 warnings potentially fixable with the `--fix` option.

Another issue is that trailingComma: 'all' breaks tests in node v6 where dangling commas in function arguments is not allowed.

Prettier should be set up as an ESLint rule using https://github.com/prettier/eslint-plugin-prettier this way linting and formatting is done when running npx eslint --fix. Another option is https://github.com/prettier/prettier-eslint-cli.

Additional Data

  • Serverless-Webpack Version you're using: 5.3.1
  • Webpack version you're using:4.33.0
  • Serverless Framework Version you're using: 1.30.3
  • Operating System: OS X 10.13
  • Stack Trace (if available):
@asprouse asprouse changed the title prettier and eslint configs conflict prettier and eslint configs conflict and break tests Jun 14, 2019
@HyperBrain
Copy link
Member

HyperBrain commented Jun 14, 2019 via email

@asprouse
Copy link
Contributor Author

Sure! If you prefer the ESLint config then we can try prettier-eslint-cli which runs prettier then eslint --fix this way you get output that looks more like your ESLint config.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants