To make it easier to check guideline JS8 https://wiki.koha-community.org/wiki/Coding_Guidelines#JS8:_Follow_guidelines_set_by_ESLint And be one step closer to able to enforce it on .vue and .ts files
Created attachment 172682 [details] [review] Bug 38149: Make ESLint config compatible with version 9 Test plan 1. Apply patch 2. Start KTD (to check that stuff is installed automatically) 3. Run this: ESLINT_USE_FLAT_CONFIG='false' eslint koha-tmpl/intranet-tmpl/prog/js/ajax.js 4. You should see errors from prettier in addition to others QA notes: 1. Run this: yarn why eslint; yarn why prettier; yarn why eslint-config-prettier; yarn why eslint-plugin-prettier 2. See that the version are the latest from NPM website 3. See that they are in devDependencies
Created attachment 172683 [details] [review] Bug 38149: Add ESLint & prettier to package.json And upgrade eslint-plugin-prettier
This is the 2nd time I'm really messing with node stuff so I don't know what I'm doing.🙃 Don't trust anything you see! The process was throwing things at the wall and see what stuck. 🫠 I don't know if there aren't too much changes in lock files. I did `yarn add prettier eslint --dev` And `yarn upgrade eslint-plugin-prettier` (I think) so package.json still has the old version but the lock has the latest so it's fine. But I don't know if package.json should still be manually updated. ---- Some things I did to double check stuff: Before applying the test plan, deleting the node_modules directory. To avoid keep manually installed stuff and wrongly thinking things worked. .eslintrc.json + ], + "prettier/prettier": [ + "error" Sabotaged one and then the other of these lines and see that it errors to confirm it's not dead config. "extends": [ "eslint:recommended", - "prettier" + "eslint-config-prettier" + ], + "plugins": [ + "eslint-plugin-prettier" Same here. ------- Next steps after this: 1. Migrate to the flat config file to avoid having that ugly ESLINT_USE_FLAT_CONFIG='false' 2. Add the necessary stuff to be able to use ESLint on .vue and .ts files. 3. Open a ticket in QA tools (try to implement, at least partially) about having the same check with ESLint as we have with perltidy. (comparing number of messy line before and after the patches) 4. ???? 5. PROFIT!!! (Finally JS8 will be fully and easily checkable!!!!! :D)
yarn.lock changes should be in a separate patch.
Created attachment 173010 [details] [review] Bug 38149: Make ESLint config compatible with version 9 Test plan 1. Apply patch 2. Start KTD (to check that stuff is installed automatically) 3. Run this: ESLINT_USE_FLAT_CONFIG='false' eslint koha-tmpl/intranet-tmpl/prog/js/ajax.js 4. You should see errors from prettier in addition to others QA notes: 1. Run this: yarn why eslint; yarn why prettier; yarn why eslint-config-prettier; yarn why eslint-plugin-prettier 2. See that the version are the latest from NPM website 3. See that they are in devDependencies
Created attachment 173011 [details] [review] Bug 38149: Add ESLint & prettier to package.json And upgrade eslint-plugin-prettier
Created attachment 173012 [details] [review] Bug 38149: [DO NOT PUSH] yarn.lock changes
(In reply to Jonathan Druart from comment #4) > yarn.lock changes should be in a separate patch. Indeed, thanks
Created attachment 174426 [details] [review] Bug 38149: Make ESLint config compatible with version 9 Test plan 1. Apply patch 2. Start KTD (to check that stuff is installed automatically) 3. Run this: ESLINT_USE_FLAT_CONFIG='false' eslint koha-tmpl/intranet-tmpl/prog/js/ajax.js 4. You should see errors from prettier in addition to others QA notes: 1. Run this: yarn why eslint; yarn why prettier; yarn why eslint-config-prettier; yarn why eslint-plugin-prettier 2. See that the version are the latest from NPM website 3. See that they are in devDependencies Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Created attachment 174427 [details] [review] Bug 38149: Add ESLint & prettier to package.json And upgrade eslint-plugin-prettier Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Created attachment 174428 [details] [review] Bug 38149: [DO NOT PUSH] yarn.lock changes Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Created attachment 174852 [details] [review] Bug 38149: Make ESLint config compatible with version 9 Test plan 1. Apply patch 2. Start KTD (to check that stuff is installed automatically) 3. Run this: ESLINT_USE_FLAT_CONFIG='false' eslint koha-tmpl/intranet-tmpl/prog/js/ajax.js 4. You should see errors from prettier in addition to others QA notes: 1. Run this: yarn why eslint; yarn why prettier; yarn why eslint-config-prettier; yarn why eslint-plugin-prettier 2. See that the version are the latest from NPM website 3. See that they are in devDependencies Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Created attachment 174853 [details] [review] Bug 38149: Add ESLint & prettier to package.json And upgrade eslint-plugin-prettier Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Created attachment 174854 [details] [review] Bug 38149: [DO NOT PUSH] yarn.lock changes Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Rebased.