How to fix Lint problems with --fix in Firebase Functions

Viewed 2029

I'ved got a firebase Function code that has quite a lot of Lint problems. How can I fix these with --fix. It was shown at the end of the error message.

firebase deploy

/Users/xxx/firebase/functions/index.js
  16:1   error  Unexpected tab character                             no-tabs
  16:1   error  Expected indentation of 6 spaces but found 1 tab     indent
  .....
  69:1   error  Unexpected tab character                             no-tabs
  69:1   error  Expected indentation of 6 spaces but found 1 tab     indent
  69:5   error  Trailing spaces not allowed                          no-trailing-spaces
  69:5   error  Block must not be padded by blank lines              padded-blocks
  71:1   error  Trailing spaces not allowed                          no-trailing-spaces

āœ– 157 problems (157 errors, 0 warnings)
  45 errors and 0 warnings potentially fixable with the `--fix` option.
1 Answers

The error message probably is coming from eslint. You can run eslint directly:

$ (cd functions && npx eslint . --fix)
# or
$ (cd functions && node_modules/eslint/bin/eslint.js . --fix)
Related