purs-loader icon indicating copy to clipboard operation
purs-loader copied to clipboard

ESLint + Editorconfig

Open toastal opened this issue 4 years ago • 0 comments

Here's my personal proposal for ESLint and Editorconfig with the aesthetic goal of blending established JavaScript standards with ergonomics slightly closer to PureScript:

With ESLint the base is eslint-config-standard which is quite common. With notable deviations:

  • Dangling commas: reduces diff issues
  • No spaces between function names and the (): nowhere in the current code seemed to be doing this
  • Double quotes: matches PureScript better
  • Spaces around values inside arrays and objects: matches purty's formatting of arrays and records for PureScript

Things the maintainer may want to adjust:

  • Semicolons on (via semi: always): it seems semicolons were used more often than not, but it wasn't consistent and eslint-config-standard uses "never"
  • Single quotes (remove the quotes block): single quotes seemed to be used more often, and while the JS community seems to have a favoritism towards singles, PureScript/Haskell/etc. use singles just for chars only which may not be the muscle memory for PureScript developers + strings 🤷‍.

Other changes caught by the linter:

  • There were some "useless" escaped \. in the RegExps according to ESLint
  • There was a loose != "" for an empty string.

To rerun+fix the linting if you were to make adjustments:

$ yarn lint:fix
# or
$ npm run lint:fix

fixes #147

toastal avatar May 29 '20 09:05 toastal