It is an immutable library, so all the typings should be readonly and ReadonlyArray.
Eslint has a plugin for it (in the eslint-plugin-functional package), so it can be automatized:
Minimum eslint config only for this rule:
module.exports = {
root: true,
env: {
browser: true,
node: true,
es6: true,
jest: true,
},
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint', 'functional'],
extends: [
],
parserOptions: {
project: './tsconfig.json',
},
rules: {
'functional/prefer-readonly-type': [
1
]
},
}
The following command will do all the work (you will need a tsconfig.json):
eslint -c .eslintrc.js index.d.ts --fix
On the latest version (6.3.1) it founds and fixes 255 non-readonly types.
It is an immutable library, so all the typings should be readonly and ReadonlyArray.
Eslint has a plugin for it (in the
eslint-plugin-functionalpackage), so it can be automatized:Minimum eslint config only for this rule:
The following command will do all the work (you will need a tsconfig.json):
On the latest version (6.3.1) it founds and fixes 255 non-readonly types.