Thanks ALL: as recommended below, I copied my rules AND the 'extends' property+value to .eslintrc.js, and now linting is working for me.
It is not really important, but I am wondering how I ended up with BOTH an .eslintrc.js and .eslinrc.json file, if one normally only needs to have one or the other. I did run eslint --init, so I'm guessing that it created the .json one, based on the input I gave it. Possibly the .js one was generated by some vue-cli commands I had previously run, to set up the project as a whole, and I didn't notice that the .js one was generated at that time. Best, Jim On Tuesday, November 8, 2016 at 4:49:27 PM UTC-5, Nicholas Zakas wrote: > > Peter is correct. The problem you're having is that .eslintrc.js doesn't > have your rules enabled, and it's ignoring .eslintrc.json because > .eslintrc.js has the highest priority. If you move all of your > configuration into .eslintrc.js, you should start seeing appropriate > warnings. > > -N > > On Tue, Nov 8, 2016 at 1:28 PM, Peter deHaan <[email protected] > <javascript:>> wrote: > >> I'm a bit confused. Are you saying you have an .eslintrc.json AND >> .eslintrc.js file? >> >> According to >> http://eslint.org/docs/user-guide/configuring#configuration-file-formats >> it seems like it will read the first matching configuration file >> (.eslintrc.js) and ignore the .eslintrc.json config file. And it looks like >> your .eslintrc.js file doesnt extend the "eslint:recommended" rules, which >> may explain why you're not getting any errors. >> >> """ >> >> If there are multiple configuration files in the same directory, ESLint >> will only use one. The priority order is: >> >> 1. .eslintrc.js >> 2. .eslintrc.yaml >> 3. .eslintrc.yml >> 4. .eslintrc.json >> 5. .eslintrc >> 6. package.json >> >> """ >> >> On Tue, Nov 8, 2016 at 1:15 PM, <[email protected] <javascript:>> >> wrote: >> >>> I can't seem to get my installation of ESLint to actually complain >>> (errors or warnings) about *anything*, in any of the files I tried, >>> even in a test file I tried that has 'obvious' errors. The details of my >>> setup >>> are below. Any ideas for troubleshooting this would be greatly >>> appreciated! Note: I also tried changing the configuration to specify >>> sourceType: script, and also es6: false, but the results were the same (no >>> errors or warnings reported). >>> >>> >>> bash (macOS) command line: >>> >>> ./node_modules/.bin/eslint --debug --no-ignore lint-test.js >>> >>> >>> >>> Results in the following output on the console: >>> >>> *eslint:cli *Running on files +0ms >>> >>> *eslint:glob-util *Creating list of files to process. +33ms >>> >>> *eslint:cli-engine *Processing >>> /Users/jimabbott/RubymineProjects/simple-project/lint-test.js +12ms >>> >>> *eslint:cli-engine *Linting >>> /Users/jimabbott/RubymineProjects/simple-project/lint-test.js +2ms >>> >>> *eslint:config *Constructing config for >>> /Users/jimabbott/RubymineProjects/simple-project/lint-test.js +0ms >>> >>> *eslint:config *Using .eslintrc and package.json files +0ms >>> >>> *eslint:config *Loading >>> /Users/jimabbott/RubymineProjects/simple-project/.eslintrc.js +2ms >>> >>> *eslint:config-file *Loading JS config file: >>> /Users/jimabbott/RubymineProjects/simple-project/.eslintrc.js +1ms >>> >>> *eslint:config *Using >>> /Users/jimabbott/RubymineProjects/simple-project/.eslintrc.js +34ms >>> >>> *eslint:config *Merging command line environment settings +0ms >>> >>> *eslint:config-ops *Apply environment settings to config +0ms >>> >>> *eslint:cli-engine *Linting complete in: 376ms +323ms >>> >>> >>> >>> Contents of the file under test (lint-test.js, at project root, NOT in >>> /build, or /config): >>> >>> var foo = bar; >>> var x; >>> if (x = y) {} >>> >>> >>> >>> My project's .eslintrc.json: >>> >>> { >>> "env": { >>> "browser": true, >>> "es6": true >>> }, >>> "extends": "eslint:recommended", >>> "parserOptions": { >>> "sourceType": "module" >>> }, >>> "rules": { >>> "indent": [ >>> "error", >>> "tab" >>> ], >>> "linebreak-style": [ >>> "error", >>> "unix" >>> ], >>> "quotes": [ >>> "error", >>> "single" >>> ], >>> "semi": [ >>> "error", >>> "always" >>> ] >>> } >>> } >>> >>> >>> >>> My project's .eslintrc.js: >>> >>> module.exports = { >>> root: true, >>> parser: 'babel-eslint', >>> parserOptions: { >>> sourceType: 'module' >>> }, >>> // required to lint *.vue files >>> plugins: [ >>> 'html' >>> ], >>> // add your custom rules here >>> 'rules': { >>> // allow debugger during development >>> 'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0 >>> } >>> } >>> >>> >>> .eslintignore: >>> >>> build/*.js >>> config/*.js >>> >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "ESLint" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to [email protected] <javascript:>. >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "ESLint" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected] <javascript:>. >> For more options, visit https://groups.google.com/d/optout. >> > > > > -- > > ______________________________ > Nicholas C. Zakas > @slicknet > > Author, Principles of Object-Oriented JavaScript <http://amzn.to/29Pmfrm> > Author, Understanding ECMAScript 6 <http://amzn.to/29K1mIy> > -- You received this message because you are subscribed to the Google Groups "ESLint" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
