@kapowaz/eslint-config v4.0.0
@kapowaz/eslint-config
This packages provides a re-usable ESLint and Prettier config that can be used for React/TypeScript projects.
Usage
Add @kapowaz/eslint-config as a dev dependency to your project. Note that you
will also need to install all of the peer dependencies directly in your project
as well, to ensure these dependencies are available. See this bug for more info:
https://github.com/eslint/eslint/issues/3458
Create a file called .eslintrc.json in the root of your project, containing
the following:
{
"extends": ["@kapowaz/eslint-config"]
}You will still need to provide a .prettierrc config file to override the
default prettier settings, e.g.
{
"printWidth": 120,
"singleQuote": true
}Publishing a new version
Until CI does this for us, you can manually publish with the yarn script yarn
ci:publish; first ensure that the section of the script that emits the .npmrc
file is commented out, and that you have publish permissions locally.
Setting up commitlint
yarn add husky -Dyarn husky installnpx husky add .husky/commit-msg 'npx --no -- commitlint --edit ${1}'- Add
"prepare": "husky install"to"scripts"key inpackage.json. If the package is published from adistdirectory, this should be"prepare": "cd .. && husky install" - Copy
commitlint.config.jsto root of project
Notes on getting Husky working in Git Tower
See this guide for details on how to configure Git Tower to avoid this error message when attempting to commit:
.husky/commit-msg: line 4: npx: command not found
husky - commit-msg hook exited with code 127 (error)
husky - command not found in PATH=/Applications/Xcode.app/Contents/Developer/usr/libexec/git-core:/Applications/Tower.app/Contents/Resources/git-flow:/Applications/Tower.app/Contents/Resources/git-lfs:/usr/bin:/bin:/usr/sbin:/sbinCreate ~/Library/Application\ Support/com.fournova.Tower3/environment.plist:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PATH</key>
<string>/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin:/Users/bdarlow/.nvm/versions/node/v14.18.1/bin:/Users/bdarlow/.nvm/versions/node/v18.13.0</string>
</dict>
</plist>Note that the tags for key and string mustn’t have any whitespace (so
disable Prettier before saving).
Notes on semantic-release
This project is relatively simple so can be used as the foundation for adding semantic-release to another project. The important steps are as follows:
yarn add -D semantic-releaseto add semantic-release to the project root. Important: this step should be skipped if the project uses Node v17 or lower, since semantic-release relies on Node 18.- Install
semantic-release-cliglobally:yarn global add semantic-release-cli - Run
semantic-release-cli setupto begin the setup process - Follow the instructions to login to npmjs.com, and provide Github and Circle CI auth tokens.
- Choose 'yes' to add Circle CI
config.ymlfile; you can use the config in this project as a template. - Copy .releaserc.json, adding any other static build artifacts that should be
committed to git as a result of the release process to the
"assets"key of the"@semantic-release/git"plugin. - Note that the initial release will be based on the version tag, which starts
at v1.0.0; if the project already has a released package with a higher
version, ensure to tag with that version first, with
git tag v<latest-version-published> && git push --tags origin
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
7 years ago
7 years ago