Releases: UN-OCHA/hpc-repo-tools
Releases · UN-OCHA/hpc-repo-tools
Update peer dependencies
Update dependencies
What's Changed
- Bump @eslint/plugin-kit from 0.2.0 to 0.2.3 by @dependabot in #53
- Bump cross-spawn from 7.0.3 to 7.0.5 by @dependabot in #54
- Bump typescript-eslint from 8.14.0 to 8.16.0 by @dependabot in #58
- Bump prettier from 3.3.3 to 3.4.1 by @dependabot in #55
- Bump husky from 9.1.6 to 9.1.7 by @dependabot in #56
- Bump eslint-plugin-unicorn from 56.0.0 to 56.0.1 by @dependabot in #57
- Update dependencies by @Pl217 in #59
- Update
globals
tov15.13.0
- Update
typescript-eslint
tov8.18.0
- Update Prettier to
v3.4.2
- Update
Full Changelog: v5.2.0...v5.3.0
Update dependencies
- Updated
globals
fromv15.9.0
tov15.12.0
(#46 & #50) - Updated
eslint-plugin-unicorn
from v55 to v56 (#48) - Updated
typescript-eslint
fromv8.8.0
tov8.14.0
(#49 & #51)- This adds official Typescript 5.6 support in
v8.10.0
- This adds official Typescript 5.6 support in
- Updated Typescript from
v5.6.2
tov5.6.3
(#51) - Updated ESLint from
v9.11.1
tov9.14.0
(#51)
Update Typescript to 5.6
Upgrade to ESLint 9
⚠️ BREAKING CHANGES ⚠️
- Upgrade to ESLint 9 and adopt flat config style (#32)
- Replace
@typescript-eslint/eslint-plugin
and@typescript-eslint/parser
packages, which were v7, withtypescript-eslint
package, which is v8 - Minimal Node.js version is now
20.15.1
and Node 18 support is dropped - Minimal NPM v10 version is raised from
10.5.0
to10.7.0
. NPM v9 is still supported, with minimal version remaining at9.6.5
Linting rule changes
- Library
eslint-plugin-unicorn
got updated from v52 to v55
Full Changelog: v4.2.0...v5.0.0
Update Typescript
Update dependencies
- Libraries
@typescript-eslint/*
got a major upgrade fromv6.9.1
tov7.7.1
(#33) - Library
eslint-plugin-unicorn
got updated from v49 to v52, but ruleunicorn/consistent-destructuring
still throws an error (even though it was removed from recommended list in v51) to keep existing behavior (#33) - Peer dependency Typescript updated to 5.4 (#33)
- Peer dependency ESLint updated to
v8.57.0
(#33) - Minimum required Node.js 18 & 20 versions increased to latest minor version (#33)
- Minimum required NPM v9 & v10 versions increased to latest minor version (#33)
Upgrade to Node.js v20 & define additional linting rules
⚠️ BREAKING CHANGES ⚠️
- Minimal supported Node.js 18 version is raised to
>=18.18.2
(#31) - Packages
@typescript-eslint/eslint-plugin
and@typescript-eslint/parser
got major version upgrade tov6.9.1
(#31) - Package
eslint-config-prettier
got major version upgrade tov9.0.0
(#31) - ESLint base config is now distributed via JS file and JSON format is no longer supported. This is done to prepare for flat ESLint config which will be rolled out in v9 (#31)
Other changes
- Minimal supported Node.js 20 version is
>=20.9.0
(#31) - Minimal supported NPM 10 version is
>=10.2.2
(#31) - Typescript peer dependency updated to
v5.2.2
(#31) - ESLint peer dependency updated to
v8.52.0
(#31) - Prettier base config uses
trailingComma: 'es5'
to keep the same behavior between v2 and v3 of Prettier (#31)
Linting rule changes
- Start using unicorn ESLint plugin for lots of new linting rules. Some rules are disabled though:
consistent-function-scoping
: There are use cases where we want inline functionsexpiring-todo-comments
: There is no particular need to expire TODO comments. There is a bunch of years-old TODO comments in some HPC repositoriesexplicit-length-check
: Just checking byif (!array.lenght) {}
, instead ofif (array.lenght === 0) {}
is enough and readable alreadyfilename-case
: Although using a single casing for file names is a great idea, it would be hard to resolve all the problems that would be reported by this rule in HPC repos. For newer code, there was an agreement to usekebab-case
(like in hpc-api). But if we accept that everywhere, model files inhpc-api-core
would breakcamelCase
standard used in DB table names. If we were to enforce camel case, there could be a conflicting use case to have a util file namedio-ts.ts
, so I decided not to have any file naming standard for nowno-array-reduce
: The reasoning ofunicorn
developers is thatArray.prototype.reduce()
is producing a hard-to-read code, but that is highly opinionated and we didn't want to disable the usage. Biggest problem is whenreduce
is used to traverse an array and it should only be used when a scalar result is producedno-array-callback-reference
: This rule would prevent heavy usage of.filter(isDefined)
that HPC has across various reposno-await-expression-member
: Conflicts with Prettier's formatting styleno-negated-condition
: Although it could be argued that negated conditions are harder to read, this rule would be too restrictiveno-null
: We definitely want to keep using bothnull
andundefined
in HPC codebasesprefer-code-point
: HPC codebases don't need that much Unicode support for this to make a differenceprefer-number-properties
: There is a mix and match ofisNaN
andNumber.isNaN
usages across HPC repos, which would be hard to standardizeprefer-string-slice
: Substring is such a common term in programming terminology that we don't want to get rid of itprefer-switch
:switch
statements aren't much easier to read and we don't want them replacing someif..else
structuresprefer-ternary
: Some people would advocate usage of ternary is a code smell and we don't want to enforce their usageprefer-top-level-await
: This would require HPC to switch to ES modules, which we want eventually, but aren't ready yetprevent-abbreviations
: Some notable people in the industry think that Hungarian notation has its place and this rule would prevent such usages. We don't want to have to renameargs
toarguments_
because it would conflict with a reserved keywordswitch-case-braces
: This is stylistic taste, but curly braces inswitch..case
block look so weirdtext-encoding-identifier-case
: We cannot enforce usage of'utf8'
because in some cases it needs to be'utf-8'
- Started using
prettier-plugin-organize-imports
to make sure formatting checks also make sure import order is right. This plugin was chosen because it uses same tooling behind VS Code's "Organize imports", thus making usage much simpler compared to another linting plugin. So, when there is a problem with import order, developers will just format the file (or use "Organize imports" in VS Code) and not have to invoke linting auto-fixing - Added more strict linting rules, both from plain ESLint and from
@typescript-eslint
plugin:no-else-return
: Disallowelse
blocks afterreturn
statements inif
statementsno-multi-assign
: Disallow use of chained assignment expressionsno-unneeded-ternary
: Disallow ternary operators when simpler alternatives existno-useless-concat
: Disallow unnecessary concatenation of literals or template literalsprefer-template
: Require template literals instead of string concatenation- For Typescript files, additional rules:
no-array-constructor
: Disallow genericArray
constructorsarray-type
: Require consistently using eitherT[]
orArray<T>
for arraysawait-thenable
: Disallow awaiting a value that is not a Thenableconsistent-generic-constructors
: Enforce specifying generic type arguments on type annotation or constructor name of a constructor callconsistent-type-imports
: Enforce consistent usage of type importsprefer-nullish-coalescing
: Enforce using the nullish coalescing operator instead of logical assignments or chainingprefer-optional-chain
: Enforce using concise optional chain expressions instead of chained logical ands, negated logical ors, or empty objects
Update dependencies
Upgrade @typescript-eslint/eslint-plugin
and @typescript-eslint/parser
packages to v5.61.0
. (#30)