@rimac-technology/style-guide v10.0.0
Style Guide
This repository encapsulates all the different configurations we use at Rimac Technology when developing with JS
Firstly install the style guide @rimac-technology/style-guide and then pick the configurations you need:
Prettier
Install
prettieras a dev dependencyCreate a new file at the root of your project called
.prettierrc.jswith the following
module.exports = {
...require('@rimac-technology/style-guide/prettier'),
}- Create a
.prettierignorefile with the following
CHANGELOG.md # If your project contains itAdd a script to your
package.jsonwithprettier --loglevel warn --no-editorconfig --no-error-on-unmatched-pattern --check \"./**/*{yaml,yml,json,md,gql,graphql,prisma}\"- Adjust the glob to match files you want to check
- This glob will match all the files recursively in your project
Do a test run and see what prettier matches and add files you don't want to check in it since prettier still doesn't support having
.gitignoreand.prettierignoreworking together
Package JSON
Install
npm-package-json-lintas a dev dependencyCreate a new file at the root of your project called
.packagerc.jswith- If you are using workspaces
module.exports = { extends: '@rimac-technology/style-guide/package-json/workspaces', }- If you are not using workspaces
module.exports = { extends: '@rimac-technology/style-guide/package-json/core', }Add a script to your
package.jsonwithnpmPkgJsonLint --configFile ./.packagerc.js .
ESLint
Install
eslintas a dev dependencyCreate a new file at the root of your project called
.eslintrc.jswith the following- Make sure
parserOptions.projectpoints to the correcttsconfig.jsonlocation
- Make sure
module.exports = {
extends: [require.resolve('@rimac-technology/style-guide/eslint/core')],
parser: '@typescript-eslint/parser',
parserOptions: {
project: './tsconfig.json',
},
ignorePatterns: ['**/*generated.json'],
}Add a script to your
package.jsonwitheslint './**/*.{js,ts}' --quiet --cache --cache-strategy content --cache-location '.eslintcache/'- Adjust the
globto match files your want to check- For example all ts, js and tsx files:
./**/*.${js,ts,tsx}
- For example all ts, js and tsx files:
- Adjust the
You can use any of the optional rulesets
@rimac-technology/style-guide/eslint/react@rimac-technology/style-guide/eslint/jest@rimac-technology/style-guide/eslint/mobx@rimac-technology/style-guide/eslint/next- You need to add a setting to point to your pages directory in
.eslintrc.jsconfig file like somodule.exports = { // Other config stuff settings: { next: { rootDir: './packages/web/', }, }, // Other config stuff }
- You need to add a setting to point to your pages directory in
- Example configuration with overrides for only
.test.tsfiles withjestruleset
module.exports = { extends: [require.resolve('@rimac-technology/style-guide/eslint/core')], parser: '@typescript-eslint/parser', parserOptions: { project: './tsconfig.json', }, overrides: [ { files: ['**/*.test.ts'], extends: [require.resolve('@rimac-technology/style-guide/eslint/jest')], }, ], }Add eslint cache to
.gitignorelike so
.eslintcacheStylelint
Install
stylelintas a dev dependencyCreate a new file at the root of your project called
.stylelintrc.jswith the following
module.exports = {
extends: '@rimac-technology/style-guide/stylelint',
}Add a script to your
package.jsonwithstylelint --cache --allow-empty-input './**/*.css'Add stylelint cache to
.gitignorelike so
.stylelintcacheCSpell
Install
cspellas a dev dependencyCreate a new file at the root of your project called
.cspell.jsonwith the following
{
"useGitignore": true,
"cache": {
"useCache": true,
"cacheStrategy": "content",
"cacheLocation": "./.cspellcache"
},
"ignorePaths": [
// Add ignored paths/files here
],
"ignoreWords": [
// Add words here
]
}Add a script to your
package.jsonwithcspell --no-progress --no-summary '**'Add cspell cache to
.gitignorelike so
.cspellcache1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago