Shared Eslint config for my projects
pnpm add -DE @devshareacademy/eslint-configNote: In order to use the package, you will need to have the peer dependencies that are listed installed in your project. You can add these dependencies by running the following command:
pnpm add -D -E eslint typescript-eslint eslint-config-prettier eslint-plugin-prettier prettier globals @eslint/jsYou can install this package from the GitHub NPM Package Repository. In order to do this, you must first authenticate with GitHub packages. You can read more about this process here: GitHub - Installing A GitHub Package.
pnpm config set @lookio:registry https://npm.pkg.github.com/
echo "//npm.pkg.github.com/:_authToken=<github_personal_access_token>" > .npmrc
pnpm add -DE @devshareacademy/eslint-configeslint.config.js
import eslintConfig from "@devshareacademy/eslint-config";
export default [
{
ignores: ["**/node_modules", "**/dist"],
},
...eslintConfig,
{
languageOptions: {
ecmaVersion: 5,
sourceType: "script",
parserOptions: {
project: "./tsconfig.json",
},
},
rules: {
"@typescript-eslint/unbound-method": "off",
},
},
];# Authenticate with NPM Package Registry
npm login
# Run publish script
yarn publish:npm
yarn publish:githubIn order to test changes locally, you can can create a symlink to this npm package folder and then reference this folder in another project locally.
To create a symlink:
# run the following command from this projects directory
npm link
# change to the directory of the project you want to use this package in
cd ../../../some-other-project
# link-install the package
npm link @devshareacademy/connect-fourPlease see the official documentation on npm link for more information.
Another option for testing changes locally is to use Verdaccio, which is a lightweight private proxy registry. With Verdaccio, you can publish this npm package to a local registry and then in another project you can install this package by pointing to the local registry.
There are a variety of ways to run Verdaccio, but in the following example we will be using Docker.
To setup and run Verdaccio:
docker run -it --rm --name verdaccio -p 4873:4873 verdaccio/verdaccioTo create a user and login:
npm adduser --registry http://localhost:4873To publish a package:
npm publish --registry http://localhost:4873To install the local package in another project:
NPM_CONFIG_REGISTRY=http://localhost:4873 npm install @devshareacademy/eslint-config
NPM_CONFIG_REGISTRY=http://localhost:4873 pnpm install @devshareacademy/eslint-config- @devshareacademy/eslint-config: eslint-config
- @devshareacademy/tsconfig: tsconfig
- @devshareacademy/prettier-config: prettier-config