How to install ESlint globally?











up vote
4
down vote

favorite












I'm trying to install ESlint to use it with Sublime Text 2 for all my local projects. Configuration documentation is very unclear about global installation:




Note: eslint --init is intended for setting up and configuring ESLint on a per-project basis and will perform a local installation of ESLint and its plugins in the directory in which it is run. If you prefer using a global installation of ESLint, any plugins used in your configuration must also be installed globally.




I don't understand what they mean. I used eslint --init and it installed ESlint locally in node_modules, along with all plugins. There's nothing explained about installing plugins globally. How do I do that? Also, how do I use the global ESlint installation if eslint --init installs local one anyway? This is so confusing.










share|improve this question


























    up vote
    4
    down vote

    favorite












    I'm trying to install ESlint to use it with Sublime Text 2 for all my local projects. Configuration documentation is very unclear about global installation:




    Note: eslint --init is intended for setting up and configuring ESLint on a per-project basis and will perform a local installation of ESLint and its plugins in the directory in which it is run. If you prefer using a global installation of ESLint, any plugins used in your configuration must also be installed globally.




    I don't understand what they mean. I used eslint --init and it installed ESlint locally in node_modules, along with all plugins. There's nothing explained about installing plugins globally. How do I do that? Also, how do I use the global ESlint installation if eslint --init installs local one anyway? This is so confusing.










    share|improve this question
























      up vote
      4
      down vote

      favorite









      up vote
      4
      down vote

      favorite











      I'm trying to install ESlint to use it with Sublime Text 2 for all my local projects. Configuration documentation is very unclear about global installation:




      Note: eslint --init is intended for setting up and configuring ESLint on a per-project basis and will perform a local installation of ESLint and its plugins in the directory in which it is run. If you prefer using a global installation of ESLint, any plugins used in your configuration must also be installed globally.




      I don't understand what they mean. I used eslint --init and it installed ESlint locally in node_modules, along with all plugins. There's nothing explained about installing plugins globally. How do I do that? Also, how do I use the global ESlint installation if eslint --init installs local one anyway? This is so confusing.










      share|improve this question













      I'm trying to install ESlint to use it with Sublime Text 2 for all my local projects. Configuration documentation is very unclear about global installation:




      Note: eslint --init is intended for setting up and configuring ESLint on a per-project basis and will perform a local installation of ESLint and its plugins in the directory in which it is run. If you prefer using a global installation of ESLint, any plugins used in your configuration must also be installed globally.




      I don't understand what they mean. I used eslint --init and it installed ESlint locally in node_modules, along with all plugins. There's nothing explained about installing plugins globally. How do I do that? Also, how do I use the global ESlint installation if eslint --init installs local one anyway? This is so confusing.







      npm sublimetext3 sublimetext eslint






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 12 at 2:14









      Robo Robok

      4,52753057




      4,52753057
























          3 Answers
          3






          active

          oldest

          votes

















          up vote
          5
          down vote













          You can install Node modules within the project (locally) or globally. To switch to globally, you may use the -g flag, like so:



          npm install -g eslint


          Then see if it's working without Sublime Text (-v flag to see the version of eslint):



          eslint -v


          To see where it was installed (assuming MacOS/Linux):



          which eslint


          Then see if it's working in Sublime Text (you may need to restart Sublime first). If it's not working, make sure in the eslint package settings that the path is correct.






          share|improve this answer





















          • I did that, but eslint --init requires some additional plugins, like for example React plugin if I intend to use React. How to make eslint --init install all plugins globally?
            – Robo Robok
            Mar 14 at 15:54












          • @RoboRobok eslint --init installs the packages simply within the package.json file of your project. Packages like React are part of your project, not an 'application' which you may install globally on your computer. You can, however, differentiate within package.json what kind of package it is within your project, by listing them either within the dependencies or the devDependencies objects.
            – Winfried
            Mar 15 at 13:47










          • I would prefer to have them globally for the purpose of linting.
            – Robo Robok
            Mar 15 at 18:55










          • According to the eslint docs, eslint --init only installs them locally. You'll need to install them globally yourself, sadly. The feature to make eslint --init install global packages seems to be open in this github issue.
            – Winfried
            Mar 16 at 9:37


















          up vote
          1
          down vote















          1. To install eslint globally: npm install -g eslint



            To install eslint in your project folder: npm install eslint --save-dev



          2. Add in package.json this script : "eslint": "eslint --ignore-path .gitignore ."



          3. Create a file called .eslintrc and insert :



            {
            "env": {
            "browser": true,
            "node": true
            },
            "globals": {
            "chrome": true
            },
            "rules": {
            "no-console": 0,
            "no-empty": [1, { "allowEmptyCatch": true }]
            },
            "extends": "eslint:recommended"
            }


            Personally, I save this file in my js folder



          4. Go to node_modules/.bin


          5. Run : eslint --init
            or npm run eslint nameOfYourFile






          share|improve this answer























          • Can you explain why step 2 is needed? I assume that it's ignoring .gitignore
            – Joseph K.
            Dec 7 at 7:08










          • This is what their doc ask to do : eslint.org/docs/2.0.0/user-guide/configuring.html
            – Marina ES
            Dec 10 at 12:20


















          up vote
          0
          down vote













          The assumption is that you have an eslint plugin installed for your editor,if you have then npm install -g eslint,then you can install add-ons for specific environments,like npm install eslint-config-airbnb eslint-plugin-react eslint-plugin-jsx-a11y eslint-plugin-import -g (this is support for pure JS and for React),you can on this way add support for nodejs too,in working folder make .eslintrc file which looks like this



          {
          "extends": ["airbnb" , "eslint:recommended"],
          "env": {
          "node": false,
          "es6": true,
          "browser": true
          },
          "rules": {
          "semi":"error",
          "no-unused-vars": "off",
          "func-names":"off",
          "indent":"off",
          "no-else-return":"off",
          "prefer-arrow-callback":"off",
          "no-undef":"off",
          "no-use-before-define":"off",
          "comma-dangle":"off",
          "eol-last":"off",
          "no-trailing-spaces":"off",
          "linebreak-style":"off",
          "no-console":"off",
          "no-restricted-globals":"off",
          "object-shorthand":"off",
          "no-shadow":"off",
          "no-debugger":"off",
          "prefer-const":"off",
          "no-multiple-empty-lines":"off"
          }
          }


          if you need node support then in env section of .eslintrc set node to 'true' and install eslint-node plugin globally too with next
          npm i eslint-plugin-node -g.
          Then in extends section of .eslintrc add "plugin:node/recommended".
          In this way, you will have eslint support in every project on your machine which have .eslintrc file.Set rules which you need in .eslintrc rules section .
          Thats it.






          share|improve this answer























            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f49227262%2fhow-to-install-eslint-globally%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            3 Answers
            3






            active

            oldest

            votes








            3 Answers
            3






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            5
            down vote













            You can install Node modules within the project (locally) or globally. To switch to globally, you may use the -g flag, like so:



            npm install -g eslint


            Then see if it's working without Sublime Text (-v flag to see the version of eslint):



            eslint -v


            To see where it was installed (assuming MacOS/Linux):



            which eslint


            Then see if it's working in Sublime Text (you may need to restart Sublime first). If it's not working, make sure in the eslint package settings that the path is correct.






            share|improve this answer





















            • I did that, but eslint --init requires some additional plugins, like for example React plugin if I intend to use React. How to make eslint --init install all plugins globally?
              – Robo Robok
              Mar 14 at 15:54












            • @RoboRobok eslint --init installs the packages simply within the package.json file of your project. Packages like React are part of your project, not an 'application' which you may install globally on your computer. You can, however, differentiate within package.json what kind of package it is within your project, by listing them either within the dependencies or the devDependencies objects.
              – Winfried
              Mar 15 at 13:47










            • I would prefer to have them globally for the purpose of linting.
              – Robo Robok
              Mar 15 at 18:55










            • According to the eslint docs, eslint --init only installs them locally. You'll need to install them globally yourself, sadly. The feature to make eslint --init install global packages seems to be open in this github issue.
              – Winfried
              Mar 16 at 9:37















            up vote
            5
            down vote













            You can install Node modules within the project (locally) or globally. To switch to globally, you may use the -g flag, like so:



            npm install -g eslint


            Then see if it's working without Sublime Text (-v flag to see the version of eslint):



            eslint -v


            To see where it was installed (assuming MacOS/Linux):



            which eslint


            Then see if it's working in Sublime Text (you may need to restart Sublime first). If it's not working, make sure in the eslint package settings that the path is correct.






            share|improve this answer





















            • I did that, but eslint --init requires some additional plugins, like for example React plugin if I intend to use React. How to make eslint --init install all plugins globally?
              – Robo Robok
              Mar 14 at 15:54












            • @RoboRobok eslint --init installs the packages simply within the package.json file of your project. Packages like React are part of your project, not an 'application' which you may install globally on your computer. You can, however, differentiate within package.json what kind of package it is within your project, by listing them either within the dependencies or the devDependencies objects.
              – Winfried
              Mar 15 at 13:47










            • I would prefer to have them globally for the purpose of linting.
              – Robo Robok
              Mar 15 at 18:55










            • According to the eslint docs, eslint --init only installs them locally. You'll need to install them globally yourself, sadly. The feature to make eslint --init install global packages seems to be open in this github issue.
              – Winfried
              Mar 16 at 9:37













            up vote
            5
            down vote










            up vote
            5
            down vote









            You can install Node modules within the project (locally) or globally. To switch to globally, you may use the -g flag, like so:



            npm install -g eslint


            Then see if it's working without Sublime Text (-v flag to see the version of eslint):



            eslint -v


            To see where it was installed (assuming MacOS/Linux):



            which eslint


            Then see if it's working in Sublime Text (you may need to restart Sublime first). If it's not working, make sure in the eslint package settings that the path is correct.






            share|improve this answer












            You can install Node modules within the project (locally) or globally. To switch to globally, you may use the -g flag, like so:



            npm install -g eslint


            Then see if it's working without Sublime Text (-v flag to see the version of eslint):



            eslint -v


            To see where it was installed (assuming MacOS/Linux):



            which eslint


            Then see if it's working in Sublime Text (you may need to restart Sublime first). If it's not working, make sure in the eslint package settings that the path is correct.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Mar 14 at 15:49









            Winfried

            2,44321720




            2,44321720












            • I did that, but eslint --init requires some additional plugins, like for example React plugin if I intend to use React. How to make eslint --init install all plugins globally?
              – Robo Robok
              Mar 14 at 15:54












            • @RoboRobok eslint --init installs the packages simply within the package.json file of your project. Packages like React are part of your project, not an 'application' which you may install globally on your computer. You can, however, differentiate within package.json what kind of package it is within your project, by listing them either within the dependencies or the devDependencies objects.
              – Winfried
              Mar 15 at 13:47










            • I would prefer to have them globally for the purpose of linting.
              – Robo Robok
              Mar 15 at 18:55










            • According to the eslint docs, eslint --init only installs them locally. You'll need to install them globally yourself, sadly. The feature to make eslint --init install global packages seems to be open in this github issue.
              – Winfried
              Mar 16 at 9:37


















            • I did that, but eslint --init requires some additional plugins, like for example React plugin if I intend to use React. How to make eslint --init install all plugins globally?
              – Robo Robok
              Mar 14 at 15:54












            • @RoboRobok eslint --init installs the packages simply within the package.json file of your project. Packages like React are part of your project, not an 'application' which you may install globally on your computer. You can, however, differentiate within package.json what kind of package it is within your project, by listing them either within the dependencies or the devDependencies objects.
              – Winfried
              Mar 15 at 13:47










            • I would prefer to have them globally for the purpose of linting.
              – Robo Robok
              Mar 15 at 18:55










            • According to the eslint docs, eslint --init only installs them locally. You'll need to install them globally yourself, sadly. The feature to make eslint --init install global packages seems to be open in this github issue.
              – Winfried
              Mar 16 at 9:37
















            I did that, but eslint --init requires some additional plugins, like for example React plugin if I intend to use React. How to make eslint --init install all plugins globally?
            – Robo Robok
            Mar 14 at 15:54






            I did that, but eslint --init requires some additional plugins, like for example React plugin if I intend to use React. How to make eslint --init install all plugins globally?
            – Robo Robok
            Mar 14 at 15:54














            @RoboRobok eslint --init installs the packages simply within the package.json file of your project. Packages like React are part of your project, not an 'application' which you may install globally on your computer. You can, however, differentiate within package.json what kind of package it is within your project, by listing them either within the dependencies or the devDependencies objects.
            – Winfried
            Mar 15 at 13:47




            @RoboRobok eslint --init installs the packages simply within the package.json file of your project. Packages like React are part of your project, not an 'application' which you may install globally on your computer. You can, however, differentiate within package.json what kind of package it is within your project, by listing them either within the dependencies or the devDependencies objects.
            – Winfried
            Mar 15 at 13:47












            I would prefer to have them globally for the purpose of linting.
            – Robo Robok
            Mar 15 at 18:55




            I would prefer to have them globally for the purpose of linting.
            – Robo Robok
            Mar 15 at 18:55












            According to the eslint docs, eslint --init only installs them locally. You'll need to install them globally yourself, sadly. The feature to make eslint --init install global packages seems to be open in this github issue.
            – Winfried
            Mar 16 at 9:37




            According to the eslint docs, eslint --init only installs them locally. You'll need to install them globally yourself, sadly. The feature to make eslint --init install global packages seems to be open in this github issue.
            – Winfried
            Mar 16 at 9:37












            up vote
            1
            down vote















            1. To install eslint globally: npm install -g eslint



              To install eslint in your project folder: npm install eslint --save-dev



            2. Add in package.json this script : "eslint": "eslint --ignore-path .gitignore ."



            3. Create a file called .eslintrc and insert :



              {
              "env": {
              "browser": true,
              "node": true
              },
              "globals": {
              "chrome": true
              },
              "rules": {
              "no-console": 0,
              "no-empty": [1, { "allowEmptyCatch": true }]
              },
              "extends": "eslint:recommended"
              }


              Personally, I save this file in my js folder



            4. Go to node_modules/.bin


            5. Run : eslint --init
              or npm run eslint nameOfYourFile






            share|improve this answer























            • Can you explain why step 2 is needed? I assume that it's ignoring .gitignore
              – Joseph K.
              Dec 7 at 7:08










            • This is what their doc ask to do : eslint.org/docs/2.0.0/user-guide/configuring.html
              – Marina ES
              Dec 10 at 12:20















            up vote
            1
            down vote















            1. To install eslint globally: npm install -g eslint



              To install eslint in your project folder: npm install eslint --save-dev



            2. Add in package.json this script : "eslint": "eslint --ignore-path .gitignore ."



            3. Create a file called .eslintrc and insert :



              {
              "env": {
              "browser": true,
              "node": true
              },
              "globals": {
              "chrome": true
              },
              "rules": {
              "no-console": 0,
              "no-empty": [1, { "allowEmptyCatch": true }]
              },
              "extends": "eslint:recommended"
              }


              Personally, I save this file in my js folder



            4. Go to node_modules/.bin


            5. Run : eslint --init
              or npm run eslint nameOfYourFile






            share|improve this answer























            • Can you explain why step 2 is needed? I assume that it's ignoring .gitignore
              – Joseph K.
              Dec 7 at 7:08










            • This is what their doc ask to do : eslint.org/docs/2.0.0/user-guide/configuring.html
              – Marina ES
              Dec 10 at 12:20













            up vote
            1
            down vote










            up vote
            1
            down vote











            1. To install eslint globally: npm install -g eslint



              To install eslint in your project folder: npm install eslint --save-dev



            2. Add in package.json this script : "eslint": "eslint --ignore-path .gitignore ."



            3. Create a file called .eslintrc and insert :



              {
              "env": {
              "browser": true,
              "node": true
              },
              "globals": {
              "chrome": true
              },
              "rules": {
              "no-console": 0,
              "no-empty": [1, { "allowEmptyCatch": true }]
              },
              "extends": "eslint:recommended"
              }


              Personally, I save this file in my js folder



            4. Go to node_modules/.bin


            5. Run : eslint --init
              or npm run eslint nameOfYourFile






            share|improve this answer
















            1. To install eslint globally: npm install -g eslint



              To install eslint in your project folder: npm install eslint --save-dev



            2. Add in package.json this script : "eslint": "eslint --ignore-path .gitignore ."



            3. Create a file called .eslintrc and insert :



              {
              "env": {
              "browser": true,
              "node": true
              },
              "globals": {
              "chrome": true
              },
              "rules": {
              "no-console": 0,
              "no-empty": [1, { "allowEmptyCatch": true }]
              },
              "extends": "eslint:recommended"
              }


              Personally, I save this file in my js folder



            4. Go to node_modules/.bin


            5. Run : eslint --init
              or npm run eslint nameOfYourFile







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Apr 18 at 18:16









            Mickael Maison

            6,78532529




            6,78532529










            answered Apr 18 at 17:48









            Marina ES

            1165




            1165












            • Can you explain why step 2 is needed? I assume that it's ignoring .gitignore
              – Joseph K.
              Dec 7 at 7:08










            • This is what their doc ask to do : eslint.org/docs/2.0.0/user-guide/configuring.html
              – Marina ES
              Dec 10 at 12:20


















            • Can you explain why step 2 is needed? I assume that it's ignoring .gitignore
              – Joseph K.
              Dec 7 at 7:08










            • This is what their doc ask to do : eslint.org/docs/2.0.0/user-guide/configuring.html
              – Marina ES
              Dec 10 at 12:20
















            Can you explain why step 2 is needed? I assume that it's ignoring .gitignore
            – Joseph K.
            Dec 7 at 7:08




            Can you explain why step 2 is needed? I assume that it's ignoring .gitignore
            – Joseph K.
            Dec 7 at 7:08












            This is what their doc ask to do : eslint.org/docs/2.0.0/user-guide/configuring.html
            – Marina ES
            Dec 10 at 12:20




            This is what their doc ask to do : eslint.org/docs/2.0.0/user-guide/configuring.html
            – Marina ES
            Dec 10 at 12:20










            up vote
            0
            down vote













            The assumption is that you have an eslint plugin installed for your editor,if you have then npm install -g eslint,then you can install add-ons for specific environments,like npm install eslint-config-airbnb eslint-plugin-react eslint-plugin-jsx-a11y eslint-plugin-import -g (this is support for pure JS and for React),you can on this way add support for nodejs too,in working folder make .eslintrc file which looks like this



            {
            "extends": ["airbnb" , "eslint:recommended"],
            "env": {
            "node": false,
            "es6": true,
            "browser": true
            },
            "rules": {
            "semi":"error",
            "no-unused-vars": "off",
            "func-names":"off",
            "indent":"off",
            "no-else-return":"off",
            "prefer-arrow-callback":"off",
            "no-undef":"off",
            "no-use-before-define":"off",
            "comma-dangle":"off",
            "eol-last":"off",
            "no-trailing-spaces":"off",
            "linebreak-style":"off",
            "no-console":"off",
            "no-restricted-globals":"off",
            "object-shorthand":"off",
            "no-shadow":"off",
            "no-debugger":"off",
            "prefer-const":"off",
            "no-multiple-empty-lines":"off"
            }
            }


            if you need node support then in env section of .eslintrc set node to 'true' and install eslint-node plugin globally too with next
            npm i eslint-plugin-node -g.
            Then in extends section of .eslintrc add "plugin:node/recommended".
            In this way, you will have eslint support in every project on your machine which have .eslintrc file.Set rules which you need in .eslintrc rules section .
            Thats it.






            share|improve this answer



























              up vote
              0
              down vote













              The assumption is that you have an eslint plugin installed for your editor,if you have then npm install -g eslint,then you can install add-ons for specific environments,like npm install eslint-config-airbnb eslint-plugin-react eslint-plugin-jsx-a11y eslint-plugin-import -g (this is support for pure JS and for React),you can on this way add support for nodejs too,in working folder make .eslintrc file which looks like this



              {
              "extends": ["airbnb" , "eslint:recommended"],
              "env": {
              "node": false,
              "es6": true,
              "browser": true
              },
              "rules": {
              "semi":"error",
              "no-unused-vars": "off",
              "func-names":"off",
              "indent":"off",
              "no-else-return":"off",
              "prefer-arrow-callback":"off",
              "no-undef":"off",
              "no-use-before-define":"off",
              "comma-dangle":"off",
              "eol-last":"off",
              "no-trailing-spaces":"off",
              "linebreak-style":"off",
              "no-console":"off",
              "no-restricted-globals":"off",
              "object-shorthand":"off",
              "no-shadow":"off",
              "no-debugger":"off",
              "prefer-const":"off",
              "no-multiple-empty-lines":"off"
              }
              }


              if you need node support then in env section of .eslintrc set node to 'true' and install eslint-node plugin globally too with next
              npm i eslint-plugin-node -g.
              Then in extends section of .eslintrc add "plugin:node/recommended".
              In this way, you will have eslint support in every project on your machine which have .eslintrc file.Set rules which you need in .eslintrc rules section .
              Thats it.






              share|improve this answer

























                up vote
                0
                down vote










                up vote
                0
                down vote









                The assumption is that you have an eslint plugin installed for your editor,if you have then npm install -g eslint,then you can install add-ons for specific environments,like npm install eslint-config-airbnb eslint-plugin-react eslint-plugin-jsx-a11y eslint-plugin-import -g (this is support for pure JS and for React),you can on this way add support for nodejs too,in working folder make .eslintrc file which looks like this



                {
                "extends": ["airbnb" , "eslint:recommended"],
                "env": {
                "node": false,
                "es6": true,
                "browser": true
                },
                "rules": {
                "semi":"error",
                "no-unused-vars": "off",
                "func-names":"off",
                "indent":"off",
                "no-else-return":"off",
                "prefer-arrow-callback":"off",
                "no-undef":"off",
                "no-use-before-define":"off",
                "comma-dangle":"off",
                "eol-last":"off",
                "no-trailing-spaces":"off",
                "linebreak-style":"off",
                "no-console":"off",
                "no-restricted-globals":"off",
                "object-shorthand":"off",
                "no-shadow":"off",
                "no-debugger":"off",
                "prefer-const":"off",
                "no-multiple-empty-lines":"off"
                }
                }


                if you need node support then in env section of .eslintrc set node to 'true' and install eslint-node plugin globally too with next
                npm i eslint-plugin-node -g.
                Then in extends section of .eslintrc add "plugin:node/recommended".
                In this way, you will have eslint support in every project on your machine which have .eslintrc file.Set rules which you need in .eslintrc rules section .
                Thats it.






                share|improve this answer














                The assumption is that you have an eslint plugin installed for your editor,if you have then npm install -g eslint,then you can install add-ons for specific environments,like npm install eslint-config-airbnb eslint-plugin-react eslint-plugin-jsx-a11y eslint-plugin-import -g (this is support for pure JS and for React),you can on this way add support for nodejs too,in working folder make .eslintrc file which looks like this



                {
                "extends": ["airbnb" , "eslint:recommended"],
                "env": {
                "node": false,
                "es6": true,
                "browser": true
                },
                "rules": {
                "semi":"error",
                "no-unused-vars": "off",
                "func-names":"off",
                "indent":"off",
                "no-else-return":"off",
                "prefer-arrow-callback":"off",
                "no-undef":"off",
                "no-use-before-define":"off",
                "comma-dangle":"off",
                "eol-last":"off",
                "no-trailing-spaces":"off",
                "linebreak-style":"off",
                "no-console":"off",
                "no-restricted-globals":"off",
                "object-shorthand":"off",
                "no-shadow":"off",
                "no-debugger":"off",
                "prefer-const":"off",
                "no-multiple-empty-lines":"off"
                }
                }


                if you need node support then in env section of .eslintrc set node to 'true' and install eslint-node plugin globally too with next
                npm i eslint-plugin-node -g.
                Then in extends section of .eslintrc add "plugin:node/recommended".
                In this way, you will have eslint support in every project on your machine which have .eslintrc file.Set rules which you need in .eslintrc rules section .
                Thats it.







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Nov 22 at 17:48









                grrigore

                698820




                698820










                answered Nov 22 at 17:17









                Goran7777

                66




                66






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.





                    Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                    Please pay close attention to the following guidance:


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f49227262%2fhow-to-install-eslint-globally%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    What visual should I use to simply compare current year value vs last year in Power BI desktop

                    Alexandru Averescu

                    Trompette piccolo