Table of Contents
This package provides Flutteruki-Gaming's base JS .eslintrc (without React plugins) as an extensible shared config.
By default, the config contains most ESLint rules, including ECMAScript 6+. It comes with:
- eslint
- eslint-plugin-import
- eslint-plugin-unused-imports
- Node
16
and above npm
- Install following dependencies under
devDependencies
:
npm install --save-dev eslint@^8.2.0
npm install --save-dev eslint-plugin-import@^2.26.0
npm install --save-dev eslint-plugin-unused-imports@^2.0.0
- Run following command that will install the shareable config in your project:
npm install --save-dev @flutteruki-gaming/eslint-config-flutteruki-gaming
- Create
.eslintrc.json
file in your project's root directory and add the following content:
{
"extends": ["@flutteruki-gaming/eslint-config-flutteruki-gaming"],
"env": {
"node": true,
"jest": true
}
}
Based on your project's needs you can add further rules
that don't exist in the shareable config or override existing ones. Also, you can add other configs, plugins, globals, parsers, envs
etc.
- The last step needed is to add linting scripts in your
package.json
under "scripts" object:
"scripts": {
...
"lint": "eslint .",
"lint-fix": "eslint . --fix"
...
}
First command will only highlight problems found in your project and the second one will fix issues automatically (if they can be fixed automatically).
You can run the above commands as:
npm run lint
npm run lint-fix
- Node
16
and above npm
- Install following dependencies under
devDependencies
:
npm install --save-dev eslint-config-prettier@^8.6.0
npm install --save-dev eslint-plugin-prettier@^4.2.1
npm install --save-dev prettier@^2.8.4
- Create
.prettierrc.json
file in your project's root directory and add the following content:
{
"printWidth": 120,
"tabWidth": 4,
"useTabs": false,
"semi": true,
"singleQuote": false,
"trailingComma": "none",
"bracketSpacing": true,
"bracketSameLine": false,
"arrowParens": "avoid",
"endOfLine": "auto"
}
Based on your project's needs you can add further rules
that don't exist in .prettierrc.json
or modify existing ones. Note that Prettier
doesn't have lots of options, so there are not many left to use.
- Modify your
.eslintrc.json
in order to supportPrettier
:
{
"extends": ["prettier", "@flutteruki-gaming/eslint-config-flutteruki-gaming"],
"plugins": ["prettier"],
"rules": {
"prettier/prettier": "error"
},
"env": {
"node": true,
"jest": true
}
}
- The last step needed is to add the scripts needed in your
package.json
under "scripts" object:
"scripts": {
...
"prettier-check": "prettier . --check",
"prettier-fix": "prettier . --write",
"pre-staged": "npm run lint-fix && npm run prettier-fix"
...
}
First command will only highlight problems found in your project and the second one will fix issues automatically (if they can be fixed automatically).
Third command will both run ESlint
and Prettier
scripts in order to fix everything that can be fixed.
You can run the above commands as:
npm run prettier-check
npm run prettier-fix
npm run pre-staged
Please follow the rules from our CONTRIBUTING guide.
This library will be published automatically using Semantic Release based on your commit messages in your merge request.
Each merge into master branch will trigger a release that will be based on your commit messages.
If you want a Breaking, Feature or Fix release please follow the guide below.
Library Release Guide
The commit message should be structured as follows:
<type>[optional scope]: <description>
[optional body]
[optional footer(s)]
Commit message | Release type |
---|---|
fix(TP444444): stop graphite breaking when too much pressure applied |
|
feat(TP444444): add 'graphiteWidth' option |
|
feat(TP444444): remove graphiteWidth option BREAKING CHANGE: The graphiteWidth option has been removed. The default graphite width of 10mm is always used for performance reasons.
|
(Note that the BREAKING CHANGE: token must be in the footer of the commit) |
Let's assume that the current version of the library is 1.2.5
-
in case of merging a MR with a fix commit, the library will be automatically bumped to 1.2.6
-
in case of merging a MR with a feat commit, the library will be bumped to 1.3.0
-
in case of merging a MR with a commit that has
BREAKING CHANGE:
in the footer of the commit, the library will be bumped to 2.0.0
If you do not wish to trigger a release, please use the other types than fix/feat as listed below:
Types Accepted | Description |
---|---|
feat |
Add a new feature to the codebase (MINOR in semantic versioning). |
fix |
Fix a bug (equivalent to a PATCH in Semantic Versioning). |
docs |
Documentation changes. |
revert |
Revert a commit. |
ci |
Code change related to CI (eg Jenkins, Pipelines) |
build |
Code change related to a particular build. |
style |
Code style change (semicolon, indentation...) |
refactor |
Refactor the code |
perf |
Update code performances. |
test |
Add test to an existing feature. |
chore |
Update something without impacting the user (ex: bump a dependency in package.json). |