{"id":238470,"date":"2021-04-29T16:00:36","date_gmt":"2021-04-29T13:00:36","guid":{"rendered":"https:\/\/en.buradabiliyorum.com\/how-to-use-gitlab-to-share-private-eslint-rules-with-your-team-cloudsavvy-it\/"},"modified":"2021-04-29T16:00:36","modified_gmt":"2021-04-29T13:00:36","slug":"how-to-use-gitlab-to-share-private-eslint-rules-with-your-team-cloudsavvy-it","status":"publish","type":"post","link":"https:\/\/buradabiliyorum.com\/en\/how-to-use-gitlab-to-share-private-eslint-rules-with-your-team-cloudsavvy-it\/","title":{"rendered":"#How to Use GitLab to Share Private ESLint Rules With Your Team \u2013 CloudSavvy IT"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_85 counter-hierarchy ez-toc-counter ez-toc-custom ez-toc-container-direction\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<label for=\"ez-toc-cssicon-toggle-item-6a3547f423f2b\" class=\"ez-toc-cssicon-toggle-label\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #dd3333;color:#dd3333\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #dd3333;color:#dd3333\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/label><input type=\"checkbox\"  id=\"ez-toc-cssicon-toggle-item-6a3547f423f2b\" checked aria-label=\"Toggle\" \/><nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/buradabiliyorum.com\/en\/how-to-use-gitlab-to-share-private-eslint-rules-with-your-team-cloudsavvy-it\/#Getting_Started\" >Getting Started<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/buradabiliyorum.com\/en\/how-to-use-gitlab-to-share-private-eslint-rules-with-your-team-cloudsavvy-it\/#Creating_Your_ESLint_Configuration\" >Creating Your ESLint Configuration<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/buradabiliyorum.com\/en\/how-to-use-gitlab-to-share-private-eslint-rules-with-your-team-cloudsavvy-it\/#Authenticating_to_Your_npm_Registry\" >Authenticating to Your npm Registry<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/buradabiliyorum.com\/en\/how-to-use-gitlab-to-share-private-eslint-rules-with-your-team-cloudsavvy-it\/#Publishing_to_GitLabs_npm_Registry\" >Publishing to GitLab\u2019s npm Registry<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/buradabiliyorum.com\/en\/how-to-use-gitlab-to-share-private-eslint-rules-with-your-team-cloudsavvy-it\/#Installing_Packages_From_Your_Registry\" >Installing Packages From Your Registry<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/buradabiliyorum.com\/en\/how-to-use-gitlab-to-share-private-eslint-rules-with-your-team-cloudsavvy-it\/#Using_Your_Packages_In_CI_Builds\" >Using Your Packages In CI Builds<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/buradabiliyorum.com\/en\/how-to-use-gitlab-to-share-private-eslint-rules-with-your-team-cloudsavvy-it\/#Summary\" >Summary<\/a><\/li><\/ul><\/nav><\/div>\n<p><strong>&#8220;#How to Use GitLab to Share Private ESLint Rules With Your Team \u2013 CloudSavvy IT&#8221;<\/strong><\/p>\n<div id=\"article-content-area\">\n<img loading=\"lazy\" decoding=\"async\" class=\"type:primaryImage aligncenter size-full wp-image-10898\" data-pagespeed-lazy-src=\"https:\/\/www.cloudsavvyit.com\/p\/uploads\/2021\/04\/93fd2933.jpg?width=1200&amp;trim=1,1&amp;bg-color=000&amp;pad=1,1\" alt=\"Graphic showing the GitLab and ESLint logos side-by-side\" width=\"1600\" height=\"900\" src=\"\/pagespeed_static\/1.JiBnMqyl6S.gif\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>ESLint statically analyses Java<a href=\"https:\/\/buradabiliyorum.com\/en\/category\/download-scripts-themes-apps\/\" data-internallinksmanager029f6b8e52c=\"9\" title=\"Download Scripts &amp; Themes &amp; Apps\" target=\"_blank\" rel=\"noopener\">Script<\/a> to identify issues before the code is run. It can also find and fix stylistic discrepancies, helping your project align with any style guides you follow.<\/p>\n<p>Creating a comprehensive <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/eslint.org\">ESLint config<\/a> can take a couple of hours. Over one hundred rules <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/eslint.org\/docs\/rules\">are available<\/a> and you need to decide which ones your team will use. ESLint ships with a \u201crecommended\u201d set of best practice rules; many other useful rules are not turned on by default.<\/p>\n<p>In this guide, we\u2019ll show how to write an ESLint config once and share it with your team using a private npm registry in GitLab. You\u2019ll be able to reuse your ESLint config across all your projects by referencing your registry package. We\u2019ll be skipping over the basics \u2013 it\u2019s assumed you\u2019ve got some experience with creating new GitLab groups and projects.<\/p>\n<h2 id=\"getting-started\"><span class=\"ez-toc-section\" id=\"Getting_Started\"><\/span>Getting Started<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>ESLint makes it easy to use shared rules. Any npm package is eligible to become an ESLint plugin. The package\u2019s entrypoint needs to export an ESLint configuration object.<\/p>\n<p>Begin by creating a new GitLab project to hold your ESLint configuration. Clone the repository down to your machine. Next, add a <code>package.json<\/code> to describe your npm package:<\/p>\n<div class=\"wp-geshi-highlight-wrap5\">\n<div class=\"wp-geshi-highlight-wrap4\">\n<div class=\"wp-geshi-highlight-wrap3\">\n<div class=\"wp-geshi-highlight-wrap2\">\n<div class=\"wp-geshi-highlight-wrap\">\n<div class=\"wp-geshi-highlight\">\n<div class=\"json\">\n<pre class=\"de1\">{&#13;\n    \"name\": \"@example-group\/eslint-config\",&#13;\n    \"author\": \"Example Author\",&#13;\n    \"description\": \"An example description\",&#13;\n    \"version\": \"1.1.0\",&#13;\n    \"main\": \".eslintrc.js\",&#13;\n    \"peerDependencies\": {&#13;\n        \"eslint\": \"&gt;=7\"&#13;\n    }&#13;\n}<\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<p>Take note of the format for the package <code>name<\/code>. This <em>must<\/em> match your project\u2019s GitLab namespace name (<code>@group\/project<\/code>). The <code>@<\/code> symbol creates a package scope. We\u2019ll use this later to instruct npm to fetch <code>@group<\/code> packages from our private npm registry. If you\u2019ve got a complex namespace name, refer to the <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/docs.gitlab.com\/ee\/user\/packages\/npm_registry\/#package-naming-convention\">GitLab documentation<\/a> to work out the correct scope name to use.<\/p>\n<p>The <code>main<\/code> field must be set to the file which will contain your ESLint configuration. We\u2019re using <code>.eslintrc.js<\/code> for this article. ESLint is specified as a peer dependency. This means projects using your library must include ESLint in their own dependencies.<\/p>\n<h2 id=\"creating-your-eslint-configuration\"><span class=\"ez-toc-section\" id=\"Creating_Your_ESLint_Configuration\"><\/span>Creating Your ESLint Configuration<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Create your actual ESLint configuration file next. Make sure you use the file you specified as <code>main<\/code> in <code>package.json<\/code>.<\/p>\n<p>Here\u2019s a basic example:<\/p>\n<div class=\"wp-geshi-highlight-wrap5\">\n<div class=\"wp-geshi-highlight-wrap4\">\n<div class=\"wp-geshi-highlight-wrap3\">\n<div class=\"wp-geshi-highlight-wrap2\">\n<div class=\"wp-geshi-highlight-wrap\">\n<div class=\"wp-geshi-highlight\">\n<div class=\"javascript\">\n<pre class=\"de1\">module.<span class=\"me1\">exports<\/span> <span class=\"sy0\">=<\/span> <span class=\"br0\">{<\/span>\n    <span class=\"st0\">\"extends\"<\/span><span class=\"sy0\">:<\/span> <span class=\"br0\">[<\/span><span class=\"st0\">\"eslint:recommended\"<\/span><span class=\"br0\">]<\/span><span class=\"sy0\">,<\/span>\n    <span class=\"st0\">\"rules\"<\/span><span class=\"sy0\">:<\/span> <span class=\"br0\">{<\/span>\n        <span class=\"st0\">\"comma-dangle\"<\/span><span class=\"sy0\">:<\/span> <span class=\"br0\">[<\/span><span class=\"st0\">\"error\"<\/span><span class=\"sy0\">,<\/span> <span class=\"st0\">\"never\"<\/span><span class=\"br0\">]<\/span><span class=\"sy0\">,<\/span>\n        <span class=\"st0\">\"indent\"<\/span><span class=\"sy0\">:<\/span> <span class=\"br0\">[<\/span><span class=\"st0\">\"error\"<\/span><span class=\"sy0\">,<\/span> <span class=\"st0\">\"tab\"<\/span><span class=\"sy0\">,<\/span> <span class=\"br0\">{<\/span><span class=\"st0\">\"SwitchCase\"<\/span><span class=\"sy0\">:<\/span> <span class=\"nu0\">1<\/span><span class=\"br0\">}<\/span><span class=\"br0\">]<\/span><span class=\"sy0\">,<\/span>\n        <span class=\"st0\">\"max-classes-per-file\"<\/span><span class=\"sy0\">:<\/span> <span class=\"br0\">[<\/span><span class=\"st0\">\"error\"<\/span><span class=\"sy0\">,<\/span> <span class=\"nu0\">1<\/span><span class=\"br0\">]<\/span>\n    <span class=\"br0\">}<\/span>\n<span class=\"br0\">}<\/span><span class=\"sy0\">;<\/span><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<p>This configuration is based on ESLint\u2019s built-in <code>recommended<\/code> rules. This gives you a good starting point to layer your own rules onto. We\u2019ve added three extra rules to ban dangling commas, limit each file to one named class, and force the use of tabs instead of spaces.<\/p>\n<h2 id=\"authenticating-to-your-npm-registry\"><span class=\"ez-toc-section\" id=\"Authenticating_to_Your_npm_Registry\"><\/span>Authenticating to Your npm Registry<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Now you\u2019re ready to publish your package to your private npm registry in GitLab. You\u2019ll need to create a GitLab API token first \u2013 click your profile icon in the top-right, then the \u201cPreferences\u201d menu item. Select \u201cAccess Tokens\u201d from the sidebar. Create a new access token with the <code>read_registry<\/code> and <code>write_registry<\/code> scopes. Note down the token value which will be displayed \u2013 you won\u2019t be able to retrieve it in the future.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-10399\" data-pagespeed-lazy-src=\"https:\/\/www.cloudsavvyit.com\/p\/uploads\/2021\/03\/9c1a4001.png?trim=1,1&amp;bg-color=000&amp;pad=1,1\" alt=\"\" width=\"1268\" height=\"459\" src=\"\/pagespeed_static\/1.JiBnMqyl6S.gif\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>Next you need to connect npm to your registry:<\/p>\n<pre>npm config set @example-group:registry https:\/\/gitlab.example.com\/api\/v4\/packages\/npm\/&#13;\nnpm config set -- '\/\/gitlab.example.com\/api\/v4\/packages\/npm\/:_authToken' \"$API_TOKEN\"<\/pre>\n<p>Replace <code>$API_TOKEN<\/code> with the API access token you generated within GitLab. The first command configures npm to fetch any package in the <code>@example-group<\/code> scope from your private registry. The second command provides npm with the registry authentication token.<\/p>\n<p>npm lets you add any number of package scopes. Each private scope needs its own authentication token. If you work in multiple GitLab groups, you\u2019ll need to define a scope for each one.<\/p>\n<h2 id=\"publishing-to-gitlabs-npm-registry\"><span class=\"ez-toc-section\" id=\"Publishing_to_GitLabs_npm_Registry\"><\/span>Publishing to GitLab\u2019s npm Registry<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>The authentication configured above applies to the <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/docs.gitlab.com\/ee\/user\/packages\/npm_registry\/#use-the-gitlab-endpoint-for-npm-packages\"><em>instance-level<\/em><\/a> GitLab npm registry. This is ideal for installing dependencies as you can access packages in any group you\u2019ve got access to, without manually specifying project IDs.<\/p>\n<p>To publish packages, you must use the <em>project-level<\/em> API endpoint. This requires separate authentication within npm. You can reuse the same API token, if it\u2019s got <code>write_registry<\/code> permissions for your project:<\/p>\n<pre>npm config set -- '\/\/gitlab.heron-web.com\/api\/v4\/projects\/&lt;id&gt;\/packages\/npm\/:_authToken<\/pre>\n<p>Replace <code>&lt;id&gt;<\/code> in the registry URL with the ID of the GitLab project you\u2019re publishing to. You can find this on the project\u2019s homepage, displayed next to its name.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-9545\" data-pagespeed-lazy-src=\"https:\/\/www.cloudsavvyit.com\/p\/uploads\/2021\/02\/91d5da6e.jpg?trim=1,1&amp;bg-color=000&amp;pad=1,1\" alt=\"\" width=\"422\" height=\"201\" src=\"\/pagespeed_static\/1.JiBnMqyl6S.gif\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>Next, update your <code>package.json<\/code> with a <code>publishConfig<\/code> object. This instructs <code>npm publish<\/code> to submit your package to your registry, instead of the public registry on <code>npmjs.com<\/code>.<\/p>\n<div class=\"wp-geshi-highlight-wrap5\">\n<div class=\"wp-geshi-highlight-wrap4\">\n<div class=\"wp-geshi-highlight-wrap3\">\n<div class=\"wp-geshi-highlight-wrap2\">\n<div class=\"wp-geshi-highlight-wrap\">\n<div class=\"wp-geshi-highlight\">\n<div class=\"json\">\n<pre class=\"de1\">{&#13;\n    \"publishConfig\": {&#13;\n        \"@example-group:registry\": \"https:\/\/gitlab.example.com\/api\/v4\/projects\/&lt;id&gt;\/packages\/npm\/\"&#13;\n    }&#13;\n}<\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<p>Run <code>npm publish<\/code> to publish your package to your GitLab registry! You should see your package show up under \u201cPackages &amp; Registries\u201d within the GitLab interface.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-10896\" data-pagespeed-lazy-src=\"https:\/\/www.cloudsavvyit.com\/p\/uploads\/2021\/04\/71713681.png?trim=1,1&amp;bg-color=000&amp;pad=1,1\" alt=\"\" width=\"946\" height=\"476\" src=\"\/pagespeed_static\/1.JiBnMqyl6S.gif\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<h2 id=\"installing-packages-from-your-registry\"><span class=\"ez-toc-section\" id=\"Installing_Packages_From_Your_Registry\"><\/span>Installing Packages From Your Registry<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>mpm commands such as <code>npm install<\/code>, <code>npm ci<\/code> and <code>npm outdated<\/code> should work without further configuration. npm will automatically consult GitLab to determine the latest version of your private packages. Files will then be downloaded directly from your registry.<\/p>\n<p>No authentication is needed to install packages from public projects. If your project\u2019s private, you\u2019ll need to provide npm with a GitLab API token as described in the preceding sections. Using a project-level endpoint will let you install that project\u2019s packages; an instance-level endpoint lets you install any package you have access to.<\/p>\n<p>Here\u2019s an example <code>package.json<\/code> for a project that consumes your ESLint config:<\/p>\n<div class=\"wp-geshi-highlight-wrap5\">\n<div class=\"wp-geshi-highlight-wrap4\">\n<div class=\"wp-geshi-highlight-wrap3\">\n<div class=\"wp-geshi-highlight-wrap2\">\n<div class=\"wp-geshi-highlight-wrap\">\n<div class=\"wp-geshi-highlight\">\n<div class=\"json\">\n<pre class=\"de1\">{&#13;\n  \"name\": \"demo\",&#13;\n  \"version\": \"1.1.0\",&#13;\n  \"devDependencies\": {&#13;\n    \"@example-group\/eslint-config\": \"^1.1\",&#13;\n    \"eslint\": \"^7.2\"&#13;\n  },&#13;\n  \"scripts\": {&#13;\n    \"lint\": \"eslint .\"&#13;\n  },&#13;\n  \"eslintConfig\": {&#13;\n    \"extends\": [&#13;\n      \"@example-group\/eslint-config\"&#13;\n    ]&#13;\n    }&#13;\n  }&#13;\n}<\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<p>Your ESLint package should be added as a development dependency so it\u2019s not installed unnecessarily. Add an <code>eslintConfig<\/code> block to configure ESLint with your package. You can now run ESLint with your custom configuration using <code>npm run lint<\/code>.<\/p>\n<h2 id=\"using-your-packages-in-ci-builds\"><span class=\"ez-toc-section\" id=\"Using_Your_Packages_In_CI_Builds\"><\/span>Using Your Packages In CI Builds<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>You don\u2019t need to do anything special to use your private packages in a CI pipeline. You\u2019ll need to update your CI script to login to your GitLab npm registry. It\u2019s usually best to generate a project-level access token with the registry scopes, rather than using your own user-level token.<\/p>\n<p>Use the commands shown above to setup npm authentication within your pipeline. Your build should then be able to run <code>npm ci<\/code> to download your dependencies and run ESLint.<\/p>\n<p>Here\u2019s an example <code>.gitlab-ci.yml<\/code> file:<\/p>\n<div class=\"wp-geshi-highlight-wrap5\">\n<div class=\"wp-geshi-highlight-wrap4\">\n<div class=\"wp-geshi-highlight-wrap3\">\n<div class=\"wp-geshi-highlight-wrap2\">\n<div class=\"wp-geshi-highlight-wrap\">\n<div class=\"wp-geshi-highlight\">\n<div class=\"yaml\">\n<pre class=\"de1\"><span class=\"co4\">stages<\/span><span class=\"sy2\">:\n<\/span>  - lint\n<span class=\"co4\">\nlint<\/span>:<span class=\"co3\">\n  stage<\/span><span class=\"sy2\">: <\/span>lint<span class=\"co3\">\n  image<\/span><span class=\"sy2\">: <\/span>node:14<span class=\"co4\">\n  script<\/span><span class=\"sy2\">:\n<\/span>    - npm config set @example-group:registry https:\/\/gitlab.example.com\/api\/v4\/packages\/npm\/\n    - npm config set -- '\/\/gitlab.example.com\/api\/v4\/packages\/npm\/:_authToken' <span class=\"st0\">\"${API_TOKEN}\"<\/span>\n    - npm ci\n    - npm run lint -- --cache<span class=\"co4\">\n  cache<\/span>:<span class=\"co3\">\n    key<\/span><span class=\"sy2\">: <\/span>$CI_COMMIT_REF_SLUG<span class=\"co4\">\n    paths<\/span><span class=\"sy2\">:\n<\/span>      - .eslintcache\n      - node_modules\/<\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<p>The pipeline contains one stage which authenticates to the private registry, installs dependencies and finally invokes ESLint using the <code>lint<\/code> script. This was setup earlier when creating the project\u2019s <code>package.json<\/code> file. To get the <code>API_TOKEN<\/code> value into your pipeline, create an <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/docs.gitlab.com\/ee\/ci\/variables\/\">environment variable<\/a> in GitLab. This lets you securely provide a token without hardcoding it into your file.<\/p>\n<p>If you plan to publish packages from CI, remember that each release needs its own unique version number. You\u2019ll need to devise a strategy to update the <code>version<\/code> field in your <code>package.json<\/code> before you <code>npm publish<\/code>. It\u2019s not possible to overwrite existing package tags.<\/p>\n<h2 id=\"summary\"><span class=\"ez-toc-section\" id=\"Summary\"><\/span>Summary<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Combining ESLint\u2019s plugin system with GitLab\u2019s private npm registries lets you share one config with all your team members. You can stop duplicating your ESLint rules across your projects, enhancing convenience and maintainability.<\/p>\n<p>The only friction lies in the one-time npm authentication when a new individual needs to install your package. Consider updating your project\u2019s <code>README<\/code> to include guidance on logging into your private registry. Authentication will persist until your GitLab API token is deleted.\n<\/div>\n<blockquote><p><strong><span style=\"color: #ff6600;\">If you liked the article, do not forget to share it with your friends. Follow us on\u00a0<span style=\"color: #ff0000;\"><a style=\"color: #ff0000;\" href=\"https:\/\/news.google.com\/publications\/CAAqBwgKMLG0nwswvr63Aw\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Google News<\/a><\/span>\u00a0too, click on the star and choose us from your favorites.<\/span><\/strong><\/p><\/blockquote>\n<blockquote>\n<p style=\"text-align: center;\">For forums sites go to <span style=\"color: #ff9900;\"><a style=\"color: #ff9900;\" href=\"https:\/\/forum.buradabiliyorum.com\/\" target=\"_blank\" rel=\"noopener\">Forum.BuradaBiliyorum.Com<\/a><\/span><\/strong><\/p>\n<\/blockquote>\n<blockquote>\n<p style=\"text-align: center;\"><strong>If you want to read more like this article, you can visit our <span style=\"color: #ff9900;\"><a style=\"color: #ff9900;\" href=\"https:\/\/en.buradabiliyorum.com\/technology\/\" target=\"_blank\" rel=\"noopener\">Technology category.<\/a><\/span><\/strong><\/p>\n<\/blockquote>\n<p><span style=\"color: black;\"><a style=\"color: #ff9900;\" href=\"https:\/\/www.cloudsavvyit.com\/10890\/how-to-use-gitlab-to-share-private-eslint-rules-with-your-team\/\" target=\"_blank\" rel=\"noopener\">Source<\/a><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>&#8220;#How to Use GitLab to Share Private ESLint Rules With Your Team \u2013 CloudSavvy IT&#8221; ESLint statically analyses JavaScript to identify issues before the code is run. It can also find and fix stylistic discrepancies, helping your project align with any style guides you follow. Creating a comprehensive ESLint config can take a couple of&#8230;<\/p>\n","protected":false},"author":1,"featured_media":238471,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"fifu_image_url":"https:\/\/www.cloudsavvyit.com\/p\/uploads\/2021\/04\/93fd2933.jpg","fifu_image_alt":"","footnotes":""},"categories":[18],"tags":[],"class_list":["post-238470","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-technology"],"_links":{"self":[{"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/posts\/238470","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/comments?post=238470"}],"version-history":[{"count":0,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/posts\/238470\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/media\/238471"}],"wp:attachment":[{"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/media?parent=238470"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/categories?post=238470"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/tags?post=238470"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}