Various `ecmaVersion` values for ESLint throughout cht-core

Does anyone know why there are so many different configurations for the ecmaVersion in the various .eslintrc files throughout the cht-core code?

  • root: 6
  • admin/tests: 8
  • api: 2017 (8)
  • config
    • covid-19/test: 8
    • default/test: 8
    • standard: 6
      • test: 8
  • ddocs: 5
  • scripts: 2017 (8)
    • generate-form-attachments: 8
    • poe: 2018 (9)
  • sentinel: 2017 (8)
  • shared-libs
    • outbound/test: 2018 (9)
    • rules-engine/test: 8
  • tests: 9
  • webapp/tests: 8

Is there a reason we could not go to at least 8 (2017) on pretty much everything?

It’s a question of compatibility based on where the code is expected to run, because we do (did) no transpiling.

  • api and sentinel are expected to work on Node 8
  • admin and webapp are expected to work on Chrome 53
  • shared libs are expected to work in Node 8 AND Chrome 53
  • ddocs are expected to work in CouchDb (Which is es5)
  • config is expected to work in Chrome 53
  • tests and scripts are looser, hence the bumped version.

Some of them may be out of date!

1 Like

Thanks @diana that is a super helpful explanation! I had forgot that we have to worry about Chrome 53 and not just Node 8 :man_facepalming:. Also, now I understand why ddocs would be so low!

Once CHT 4.0.0 is released we’ll have an opportunity to increase many of these due to higher required browser and node versions. That would be a good time to standardise more as well. To help with this there is a standardised eslint config that should be updated and rolled out more widely.