Skip to content

janziemba/frontend-shared-configs

Repository files navigation

Frontend shared configs for ESLint, Prettier, TypeScript, .editorconfig, commitlint, etc.

Getting started

Copy the .npmrc file to your project

ESLint configs

For example:

yarn add @janziemba/eslint-config-base @janziemba/eslint-config-react @janziemba/eslint-config-typescript

.eslintrc.js

module.exports = {
    extends: [
        require.resolve('@janziemba/eslint-config-base'),
        require.resolve('@janziemba/eslint-config-react'),
        require.resolve('@janziemba/eslint-config-typescript'),
    ],
};

Other configs

yarn add @janziemba/frontend-shared-configs

.vscode

In VS Code, install ESLint plugin and Prettier plugin

Settings

Copy + paste the file .vscode/settings.json to your project.

.commitlintrc.js

module.exports = {
    extends: [require.resolve('@janziemba/frontend-shared-configs/.commitlintrc.js')],
};

.editorconfig

Copy + paste the file .editorconfig

.lintstagedrc.js

See example in .lintstagedrc.js

.prettierrc.js

module.exports = require('@janziemba/frontend-shared-configs/.prettierrc.js');

.releaserc.js

module.exports = {
    extends: [require.resolve('@janziemba/frontend-shared-configs/.releaserc.js')],
};

tsconfig.json

{
    "extends": "./node_modules/@janziemba/frontend-shared-configs/tsconfig.json"
}

Husky

yarn add husky pretty-quick lint-staged --dev
npm set-script prepare "husky install && echo 'PATH=$PATH:'$PATH >> .husky/_/husky.sh"
yarn prepare
yarn husky add .husky/pre-commit "yarn pretty-quick --staged && yarn lint-staged && yarn tsc"
yarn husky add .husky/commit-msg 'yarn commitlint --edit "$1"'

See: typicode/husky#904 (comment)

About

Frontend shared configs for ESLint, Prettier, TypeScript, .editorconfig, commitlint, etc.

Resources

Stars

Watchers

Forks