@cksource-cs/eslint-config-cs-module

4.1.2 • Public • Published

ESLint/Typescript Dev Config Module

This is the module with configuration for ESlint and Typescript used in every module in CS.

Migration to > 3.0.0

Version 3.0.0 introduces some lint rules that can require some manual fixes (everything based on comments during the code review process) and introduce config for Typescript > 4.

From version 3.0.0 this module requires specific dependencies:

  • "eslint": "8.6.0"
  • "eslint-import-resolver-node": "0.3.6"
  • "typescript": "4.5.4"

Note: it may be a situation when @types/node module is not updated. The best option update this module to 20.11.1.

So, the migrations process should contain similar steps:

  1. Update devDependencies (eslint, Typescript, etc.) in project.
  2. Update @cksource-cs/eslint-config-cs-module to version > 3.0.0
  3. Run pnpm cli build [package_name] or npm run build
  4. Run npm run lint:fix
  5. Fix manually all lint problems.
  6. Run npm run lint
  7. Run all tests.
  8. Fix tests.

Note: it can be a problem with ts-node in Mocha tests so recommendation is to remove ts-node and use approach with dist-tests. More information about migrating from Mocha to AVA can be found here: https://www.notion.so/Migrating-from-Mocha-to-AVA-48bd10bf8be141349c4a8d302d5f957d .

Updating linter rules

If you believe we need to change the ESLint rules, make sure to discuss it with the team first. Once you get the go-ahead, follow the steps below to update the package across the whole CS:

  1. Update eslintrc.js as needed (with generic ESLint rules) and/or typescript.js (TS-specific rules only).
  2. Bump the version of this module (eslint-config-cs-module) in package.json.
  3. To estimate how much work will be needed to update the linter module in other packages, create local links and try applying auto-fixes:
csli link --min-version=3.0.0 eslint-config-cs-module && \
csli run lint:fix
  1. If you're happy with the changes, proceed with a PR and release the new version of the ESLint module.
  2. Once the PR has been merged, switch to master. Go to the CS repository root and run the following command to upgrade the ESLint module in all client packages. The command will also attempt to auto-fix any errors, similarly to what we did in step 2.
pnpm recursive install --dev && \
csli run deps:check --command-options="-u,-f @cksource-cs/eslint-config-cs-module" && \
pnpm recursive install --dev && \
csli run lint:fix
  1. Apply manual fixes if needed, commit the changes to a feature branch and create a PR.

Readme

Keywords

none

Package Sidebar

Install

npm i @cksource-cs/eslint-config-cs-module

Weekly Downloads

3,596

Version

4.1.2

License

UNLICENSED

Unpacked Size

36.8 kB

Total Files

6

Last publish

Collaborators

  • pmazurek-cksource
  • fiiiiii
  • jugglingjsons-cksource
  • noxuhax.tiny
  • sdudzik-cksource
  • korobochkin
  • yacodes
  • rinat.khusyainov
  • ilia-sidorov-tiny
  • igor-kuznetsov
  • dimakovalevsky
  • p.wiaderny
  • lukaszgudel
  • mhartwich-cksource
  • lkaleta
  • mzmijewski
  • rpotyka-cksource
  • mpytel-cksource
  • dszczepaniak-cksource
  • smarkowicz-cksource
  • bartoszputek
  • bartekczerwonka
  • sdomas
  • d.pawlowski.cksource
  • s.greczyn
  • p.miszczak
  • kacper.betanski