[](https://github.com/linz/style-js/actions) [](https://github.com/linz/style-js/blob/master/LICENSE)
npm install @linzjs/style

NPM configuration for base typescript projects
Includes:
- Prettier
- Eslint
- Typescript
And configuration for saneish defaults, which can be extended
Most of these are the raw defaults/recommended settings from typescript, eslint and prettier.
``typescript
export class FooBar {
get foo(): number {
return 1;
}
async bar(): Promise
return 'bar';
}
/**
* @param foo foo to bar
*/
fooBar(foo = 'foo'): string {
return ${foo}bar;`
}
}
1. Install eslint using the extensions menu
2. Add the following to your settings.json
`json`
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
"eslint.validate": ["javascript"],
IntelliJ has ESLint support by default,
1. Open the settings in Languages & Frameworks > JavaScript > Code Quality Tools > ESLint
2. Check Automatic ESLint Configuration
1. Install LINZ Style
`bash`
npm install @linzjs/style
2. Applying eslint config
There are two ways to apply the config
Either create the base configuration files
`bashnode ./node_modules/@linzjs/style/build/src/install.jsIf on windows run
`- tsconfig.json
- .eslintrc.cjs
- .prettierrc.cjs
npx linz-style-install
Or extend your existing eslintrc.js config
Example extending the .eslintrc.js file in your project`js
module.exports = {
extends: ["./node_modules/@linzjs/style/.eslintrc.cjs"],
overrides: [
{
/* Overrides for typescript /
files: ["/.ts", "/.tsx"],
rules: {
"@typescript-eslint/super-crazy-hook-rule": "error",
},
},
]
}
`
3. Apply the formatting/linting to all source code
```
npx eslint .
See Migration Docs