What is the command to enable ESLint for my cloud functions?
For a bit of background info, I ran firebase init
and did the set up, but for some reason it was using ESLint instead of TSLint. I redid the firebase init
and this time I answered "No" when it asked if I wanted to use ESLint. However, as the comments pointed out, ESLint is now favored and TSLint is deprecated. So now I need to re-enable ESLint for this project.
2
Answers
This Video below is a great starter on how to set up your cloud functions including your mentioned eslint, typescript, very informative
Explanation
By taking a look at the repository for the
firebase-tools
utility, you can find the templates used in thefirebase init
command.For linting with
eslint
, you will need the following files:.eslintrc.js
,package.json
, andtsconfig.dev.json
Once you have updated those files appropriately, run
npm install
in yourfunctions
directory so that the required libraries are downloaded.You will also need to add these lines to your
firebase.json
file in your project directory so that your functions are linted and transpiled before deployment..eslintrc.js
,package.json
, andtsconfig.dev.json
, as they were at the time of writing, have been included below for convienience. Please consult their respective links if obtaining them in the future as they may have changed.