Skip to content

prettier and eslint configs conflict and break tests #515

@asprouse

Description

@asprouse

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):

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions