diff --git a/README.md b/README.md index 204004a..1475582 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,34 @@ literals are passed to the translation functions. It is closely tied to the [Agama](https://github.com/agama-project/agama) project and probably does not make much sense for other projects. +## Installation + +Run + +```shell +npm install --save-dev @agama-project/eslint-plugin-agama-i18n +``` + +Update your ESLint configuration: + +```js +// eslint.config.mjs +import agamaI18nEslintPlugin from "@agama-project/eslint-plugin-agama-i18n"; + +export default [ + { + plugins: { + "agama-i18n": agamaI18nEslintPlugin, + }, + }, + { + rules: { + "agama-i18n/string-literals": "error", + } + } +]; +``` + ## Disabling the Check In some rare cases using a variable instead of a string literal is correct. In @@ -24,6 +52,12 @@ const sz = getSize(); return {_(sz)}; ``` +## Publishing new version + +The NPM package is automatically published by a GitHub Action when a version tag is created. + +To create a new tag update the version in `package.json` and run the `npm run tag` command. + ## Links - https://eslint.org/docs/latest/extend/custom-rule-tutorial - tutorial for diff --git a/package.json b/package.json index 8407a46..2ed1159 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { - "name": "eslint-plugin-agama-i18n", - "version": "0.1.2", + "name": "@agama-project/eslint-plugin-agama-i18n", + "version": "1.0.0", "description": "A simple ESLint plugin which checks that only string literals are passed to the translation functions", "homepage": "https://github.com/agama-project/eslint-plugin-agama-i18n", "repository": { @@ -8,9 +8,13 @@ "url": "git+https://github.com/agama-project/eslint-plugin-agama-i18n.git" }, "license": "MIT", + "publishConfig": { + "access": "public" + }, "main": "eslint-plugin-agama-i18n.js", "scripts": { - "test": "node string-literals.test.js" + "test": "node string-literals.test.js", + "tag": "VERSION=`jq -r .version package.json` && echo git tag -s -m \"Version $VERSION\" v$VERSION && echo git push origin v$VERSION" }, "peerDependencies": { "eslint": ">=9.0.0"