Git Product home page Git Product logo

brackets-eslint's Introduction

ESLint Build Status

Heads up! Beginning with version 1.11, Brackets now includes a prepackaged version of ESLint. If you want to get the possible benefits of the standalone brackets-eslint such as a faster release cycle, you might have to uninstall the default extension first via Extension Manager -> Installed -> ESLint (and vice versa if you want to use the prepackaged one).

Brackets extension which provides file linting with ESLint.

Uses CLIEngine from https://www.npmjs.com/package/eslint which should provide same results as linting in the command line (respecting all .eslintrc files)

Includes support for custom parsers and plugins.

How to install

Use brackets-npm-registry

How to configure

Use standard .eslintrc file like this one

Configuring ESLint

More information here

How to use custom rules

Move them to .eslintrules folder in your project root like you can see in this repo.

Custom parsers and plugins

Extension uses eslint plugins installed in the current project. If you're missing a plugin, then in your project directory do:

npm install eslint-plugin-react

Configuration defaults

To disable the both warning and error icons in the gutter you can configure the brackets.json as followed:

{
  "brackets-eslint.gutterMarks": false
}

or only disable warnings icons:

{
  "brackets-eslint.gutterMarks": { "error": true, "warning" : false }
}

To force the extension to use its own local version of ESLint:

{
  "brackets-eslint.useLocalESLint": true
}

Publishing new version of the extension

clone:

https://github.com/brackets-userland/brackets-eslint
cd brackets-eslint

get latest version from origin (discarding local changes):

git fetch origin
git reset --hard origin/master
git status (should say 'nothing to commit, working tree clean')

make sure the extension is built locally:

npm install

raise the version & publish:

npm version [major | minor | patch]
git push
git push --tags
npm publish

pack all except .git and node_modules folders into a zip file and upload to brackets-registry one thing here - someone's blocking 'brackets-eslint' name so I rename the name of the extension to:

"name": "zaggino.brackets-eslint",

before zipping in package.json, maybe ask registry maintainers to look into this after zipping just do git reset --hard to revert again

brackets-eslint's People

Contributors

codespool avatar djusv avatar ficristo avatar hirse avatar ksathyanm avatar lkcampbell avatar petetnt avatar zaggino avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

brackets-eslint's Issues

no-undef Promise

Hello!

Thanks for this great plugin!
I have a, for me at least, weird problem with it. In Brackets with brackets-eslint I get this error:

ERROR: 'Promise' is not defined. [no-undef] return new Promise((resolve, reject) => {

I don't get the error however when checking it with eslint manually. As far as I can tell I'm using eslint 3.12.0 both globally and in brackets-eslint. My .eslintrc is in my ~/directory.

I can get around the error by adding /* global Promise: true */, but wish I didn't have to since it works without it in "normal" eslint. Hope this can be fixed or if anyone can spot something I've setup wrong.

cheers!

eslint minified files

Does Eslint works on minified Java script files? If yes then does it need any extra functionality to be added. Currently my ESLINT is not scanning any minified files.

Error: not found: npm

[node-error 8:47:20 PM] Error: not found: npm
    at F (/Users/adri/Library/Application Support/Brackets/extensions/user/brackets-eslint/node_modules/enable-global-packages/node_modules/find-global-packages/node_modules/which/which.js:72:28)
    at E (/Users/adri/Library/Application Support/Brackets/extensions/user/brackets-eslint/node_modules/enable-global-packages/node_modules/find-global-packages/node_modules/which/which.js:75:29)
    at /Users/adri/Library/Application Support/Brackets/extensions/user/brackets-eslint/node_modules/enable-global-packages/node_modules/find-global-packages/node_modules/which/which.js:83:16
    at Object.oncomplete (fs.js:107:15)NodeDebugUtils.js:114 handleLogEvent/utils/EventDispatcher.js:222 trigger/utils/EventDispatcher.js:260 triggerWithArray/utils/NodeConnection.js:479 NodeConnection._receive

Also I get this but not sure if related

[CodeInspection] Provider ESLint (async) failed: cleanup/language/CodeInspection.js:262 (anonymous function)thirdparty.min.js:559 jthirdparty.min.js:559 k.fireWiththirdparty.min.js:559 e.(anonymous function)main.js:62 (anonymous function)thirdparty.min.js:559 (anonymous function)thirdparty.min.js:559 jthirdparty.min.js:559 k.fireWiththirdparty.min.js:559 e.(anonymous function)/utils/NodeConnection.js:230 (anonymous function)/utils/NodeConnection.js:229 NodeConnection._cleanup/utils/NodeConnection.js:327 NodeConnection.connect/utils/NodeConnection.js:266 self._ws.onclose

And the global packages are not working for me, on a mac now :/

Support for custom rules

ESLint allows to specify a directory from which to load rules files with the --rulesdir option.
The ESLint CLIEngine has an option rulePaths which has the same functionality.

I suggest to search for folders with the name .eslintrules in the open project and add them to the rulePaths.
When I call ESLint from the project root on the command line, I can even use a wildcard to add a rules from anywhere in the project:
eslint --rulesdir */.eslintrules src/ui

disabling JSLint in favour of ESLint

Sorry to ask this as it's not something you should be answering but I've installed ESLint but JSLint is still active in Brackets how can I disable JSLink in favour of ESLint and have it so for all new files/scripts.

Parsing error: Unexpected token function

I keep getting this error inside brackets:

.then(async function (message) {  //in this line
   //await stuff
});

But when I try to check it with eslint in the command line it works like it should.
This is what my .eslintrc.json looks like:

{
    "env": {
        "es6": true,
        "node": true
    },
    "extends": "eslint:recommended",
    "parserOptions": {
        "sourceType": "module",
        "ecmaVersion": 8
    },
    "rules": {
        "indent": [
            "error",
            4
        ],
        "linebreak-style": [
            "error",
            "windows"
        ],
        "quotes": [
            "error",
            "double"
        ],
        "semi": [
            "error",
            "always"
        ]
    }
}

Since the the readme file say that it "should provide same results as linting in the command line" I would say that this bug.

eslint-config-angular support

Is it possible to get this working with eslint-config-angular?

I have been having issues with it not finding the module, even though I have tried both global and local installations.

Thanks!

Legacy node process detected?

I'm getting an error that says ESLintError: Legacy node process detected (0.10.24), please update to Brackets 1.8 or Brackets-Electron to support ESLint 3.5.0 /*

Now I am running brackets 1.8, so I'm not sure what is going on.

Extension error by brackets

So I had this error #42 and I try to install it manually but after manual installation brackets tell me no linter available for JavaScript.
manual installation been:

cd ~/Library/Application\ Support/Brackets/extensions/user/
git clone https://github.com/zaggino/brackets-eslint brackets-eslint
cd brackets-eslint
npm install

I run npm test to check if there was something wrong on the build but no error any way to fix this ?
brackets -v 1.7

Does not install using standard tools

Hi, not sure why you've decided not to use the standard package manager?

I really don't want to have to think about 2 different ways of installing and updating packages for my editor, it is really annoying.

Please consider changing to support the standard package manager so that we can all enjoy the benefits of ESLint without having to mess around.

ESLint terminated with error: cleanup (continued...)

Continuing from adobe/brackets/issues/11613 (and adobe/brackets/issues/10842 and /issues/14...)

While trying to debug this issue, I have tried all the steps mentioned in adobe/brackets/issues/11613 (disabling NodeSearch, running from a lightning fast SSD instead of a network drive...) plus things like removing all the global modules, removing all the extensions sans brackets-eslint related one by one, using AppInit to wait until everything has been loaded in brackets-eslint and this is still happening no matter what.

There is one gotcha though: ESLint works as intended if the file that's open on launch isn't a JavaScript file.

  1. Open index.html
  2. Close Brackets
  3. Open Brackets
  4. Navigate to Foo.js
  5. Eslint works as intended
  6. Close Brackets
  7. Open Brackets
  8. ESLint terminated with error: cleanup -> Restart Node ->
    image
    -> Have to restart whole app again

I still have no idea what's actually causing it and I am quite sure that it is actually an issue how Brackets handles domain. The reason I am reposting this here is to brainstorm on some ideas how to avoid this (in brackets-eslint or otherwise), workarounds or just bug fixes with an hammer.

Extension requires a newer version of Brackets

If you search for this extension in the Brackets (1.5) repo, you'll find that there's a yellow message stating that the user needs a newer version of Brackets to install this plugin. Brackets 1.5 is the latest as of this writing.

Looks like the engines.brackets property in your package.json is formatted incorrectly. Should be something like:

"engines": {
    "brackets": ">=0.42.0"
}

Global node modules not found

Hello,

I recently started to write some code using AngularJS and I'm getting used to work in nodejs/npm environments. When configuring my global npm modules path I followed these instructions.

Later, when I tried to use this brackets extension with angularjs plugin I got an error saying that the plugin wasn't found although I have installed it before globally. Looking in the code I found that "NODE_PATH" environment variable was used to search for npm installed modules (see [1])

Then I looked over npm documentation and it describe the prefix configuration as the folder structure used in npm (see [2]).

I solved my problem adding npm config get prefix/lib/node_modules to NODE_PATH. It would be great if you can add this to the readme or change/improve the code to search in npm prefix folder.

If you think I can help you with a PR, I can try to solve it.

[1] https://github.com/zaggino/brackets-eslint/blob/39de935fd9b9cb456bb696322dc000f03326e1be/domain.js#L97
[2] https://docs.npmjs.com/files/folders#prefix-configuration

ESLintError: You need to install ESLint in your project folder....

I have this error with intalled 3.5.0 eslint (with 2.7.0 everything is Ok)
Brackets Release 1.8 build 1.8.0-17080
Windows 8.1

"eslint-config-airbnb": "^11.1.0",
"eslint-plugin-babel": "^3.2.0",
"eslint-plugin-import": "^1.15.0",
"eslint-plugin-jsx-a11y": "^2.2.2",
"eslint-plugin-react": "^6.2.1",

how to install so brackets can use it???

I feel like I'm in a circular reference. I have brackets-npm-registry correctly installed.
It appears in the brackets app as an Installed extension. ESLint is listed in available but not compatible with version, click the more info link which loads the brackets-npm-registry page.
I have tried doing npm install brackets-eslint as well as npm install eslint within the brackets-npm-registry folder. Both are listed in the node_modules subfolder.
Thanks in advance! Have recently found eslint which I have globally uninstalled and reinstalled and it works on cmd line. Please let me know how to 'use brackets-npm-registry to install'

support .eslintignore?

I was wondering if the roadmap includes a plan to support .eslintignore. The same can be achieved using the inline comment syntax, but some of the js files come from bower and I'm reluctant to touch them as it feels like a slippery slope. In some cases the files are so physically large (maybe?) that it completely hangs brackets. :( I went to see what version of jQuery was in a project and should have started with bower list from terminal, but I clicked on the file in the list and brackets completely locked up.

How to configure (missing link in README file)?

So I have everything installed in brackets but only error it shows is when I put single (unclosed) curly bracket somewhere in the code. Otherwise it always shows green check mark even when there are errors. So I guess I must configure it somehow but I can't find clear instructions and the link to sample file in README.md is dead. How should the config file look, where do I put it and is there anything else that needs to be done in order for Brackets to be able to get all the files it needs?

Problem with configuring eslint

Hello

I have a problem with configuring eslint in Brackets. It doesn't matter where I put my .eslintrc file (either \Brackets\extensions\user\brackets-eslint or the project folder) I always get an error in gutter:

ESLint terminated with error: ENOENT, no such file or directory

Console log in F12 throws this error:

[CodeInspection] Provider ESLint (async) failed: ENOENT, no such file or directory

My specs:
Win 7 x64
node v. 6.2.1
npm v. 3.9.3
Brackets v. 1.7.0.-16898
brackets-eslint v. 2.9.1
eslint v. 3.2.2

Any help would be appreciated.
Thanks in advance.

Hover tooltip on guttermarks

Could a tooltip with eslint warning/error message text be displayed when hovering by mouse over the guttermarks? It's a bit clumsy to lookup the message using line number in the (bottom) report panel.

eslint-plugin-vue not work?

I installed eslint-plugin-vue. But it dosen't work .

eslint config

{
    "extends": "airbnb-base",
    "plugins": [
        "import",
        "vue"
    ],
    "globals": {
        "XMLHttpRequest": 1,
        "FormData": 1,
        "File": 1,
        "Blob": 1
    },
    "rules": {
        "func-names": 0,
        "prefer-template": 0,
        "dot-notation": 0,
        "radix": 0,
        "no-mixed-operators": 0,
        "no-param-reassign": 0,
        "no-console": 0,
        "comma-dangle": 0
    }
}

Eslint terminated with an error: [object Object]

.eslintrc.json:

{
  "parser": "babel-eslint",
  "extends": "airbnb",
  "env": {
    "browser": true
  }
}

package.json:

{
  ...
  "devDependencies": {
      ...,
      "babel-eslint": "^7.1.1",
      "eslint": "^3.10.2",
      "eslint-config-airbnb": "^13.0.0",
      "eslint-plugin-import": "^2.2.0",
      "eslint-plugin-jsx-a11y": "^3.0.1",
      "eslint-plugin-react": "^6.7.1",
      ....
    },
    ...
}

Might be relevant:

$ npm list --depth=0
...
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- UNMET PEER DEPENDENCY [email protected]
+-- [email protected]
...

npm ERR! peer dep missing: eslint-plugin-jsx-a11y@^2.2.3, required by [email protected]

Brackets throws:
ESLint terminated with an error: [object Object]

Running eslint . --ext .js,.jsx works fine.

Enabling Default Rules?

Hello, I read through the user-guide, and the read me, and many of the links provided, but I think I need further help activating specific default rules.
To turn on rules, all I need to do is create a "eslintrules.json" file in the "C:\Users%USERNAME%\AppData\Roaming\Brackets\extensions\user\brackets-eslint.eslintrules"
Directory? Or do I put these in the ".brackets.json" file in "C:\Users%USERNAME%\AppData\Roaming\Brackets\extensions\user\brackets-eslint" Directory?
If I do make my own file, do I just write the code like this?

{
   "env":{
	"node": 1
}
	"rules": {
		"constructor-super": "error",
		"no-case-declarations": "error",
		"no-class-assign": "error"
      }
}

or do I add these to the .brackets.json like so:

{
  "smartIndent": true,
  "spaceUnits": 2,
  "useTabChar": false,
  "language": {
    "javascript": {
      "linting.prefer": ["ESLint"],
      "linting.usePreferredOnly": true
    }
  }
"env":{
"node": 1
}
"rules": {
		"constructor-super": "error",
		"no-case-declarations": "error",
		"no-class-assign": "error"
      }
}

Let me know, guys! Thank you so much!

Have I installed properly ESLint?

As a complete newbie to JS I've got a simple brackets project. I can run a JS script and it works. But I'm not sure ESLint is activated as when I change the JS code to throw an error nothing comes up so there is no sign ESLint is working and activated (JSLint in contrast was throwing up so many messages ). I've followed the installation steps and can see ESLint in the Brackets extension manager and the brackets-npm-registry both confirm the linter is installed. I've tried searching for answers and your wiki page for this project is empty and there doesn't seem to be any instructions for someone like myself who is new to this. Hope you can help.

BTW the embedded link below does not work....
How to configure
Use standard .eslintrc file like this one

v0.21

Can we have an update to 0.21? I want to use the new extends feature.

Support globally installed plugins

Is there a possibility to properly support custom plugins? I had to install the plugin in the brackets-eslint project to make it work. The standard cli seems to find the plugin fine.

Parsing error: The keyword 'const' is reserved

Not sure why but somehow it started giving me this error.
I have es6: true in my .eslintrc.js
Running eslint from command line works fine and setting env inline in the file also works

any ideas on how to fix or debug?
I tried: reinstall (hence how I found the registry error ;)), using root: true, using old .eslintrc

Setting gutterMarks on ignored file patterns (such as dotfiles) fail

Steps to repro:

  1. In a project that contains an .eslintrc...
  2. Create .foo.js and open it
  3. Timeout error is show on the lint panel and the following error is logged:
 Uncaught TypeError: Cannot read property 'chunkSize' of undefined codemirror.js:7772 
getLine codemirror.js:4780 
changeLine codemirror.js:5080 
(anonymous function) codemirror.js:3199
(anonymous function) GutterManager.js:104 
(anonymous function)GutterManager.js:97 
showGutters GutterManager.js:125 
refresh main.js:93
(anonymous function) jquery-2.1.3.min.js:2
(anonymous function) jquery-2.1.3.min.js:2 
j jquery-2.1.3.min.js:2 
k.fireWithNodeConnection.js:485 NodeConnection._receive

Following lines are the ones relevant to brackets-eslint:
https://github.com/zaggino/brackets-eslint/blob/master/main.js#L93.
https://github.com/zaggino/brackets-eslint/blob/master/src/GutterManager.js#L125
https://github.com/zaggino/brackets-eslint/blob/master/src/GutterManager.js#97
https://github.com/zaggino/brackets-eslint/blob/master/src/GutterManager.js#104

Auto-fix doing nothing

I am using Barackets Release 1.7 build 1.7.0-16898 (release b0a363b71) with brackets-eslint 2.5.0 installed by url.

Auto-fix seems to have no affect.

ignore minified files

I was pleasantly surprised to see Miguel Castillo's interactive linter ignore minified files and was wondering if you had plans to do something similar. It's a fairly weak test in that it just looks at the amount of whitespace in a file, but it works well enough and is better than nothing.

Can't install through brackets-npm-registry

Using Brackets 1.7 (w/ Extract) on OSX 10.11.6 I get the following error upon installation of ESLint through brackets-npm-registry:

ERROR: "Error: spawn ENOENT\n at errnoException (child_process.js:980:11)\n at Process.ChildProcess._handle.onexit (child_process.js:771:34)"

Error after manual install

I get this error after manual install
ESLint terminated with error: Unable to load one of the modules: C:/Users/cam/AppData/Roaming/Brackets/extensions/user/brackets-eslint/domain, reason: Command zaggino.brackets-eslint.lintFile already registered

win7

ESLint terminated with an error: [object Object]

Similar issue - #50

I've created a sample redux-node-app, where I have this issue with brackets editor. Gulp task for eslint works. eslint command line works. npm run lint ("lint": "eslint . --ext .js,.jsx") works.

"devDependencies": {
    "eslint": "^3.15.0",
    "eslint-config-airbnb": "^14.1.0",
    "eslint-plugin-import": "^2.2.0",
    "eslint-plugin-jsx-a11y": "^4.0.0",
    "eslint-plugin-react": "^6.10.0",
    "gulp-eslint": "^3.0.1"
  }
apples-MacBook-Pro:server Sudheesh$ npm ls -g --depth=0
/usr/local/lib
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
└── [email protected]
apples-MacBook-Pro:server Sudheesh$ npm ls --depth=0
[email protected] /Users/sudheesh/Development/Learn/redux-node-app/server
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
└── [email protected]

Brackets version: 1.8 build 1.8.0-17108
Node: v6.9.2

apples-MacBook-Pro:server Sudheesh$ npm run lint

> [email protected] lint /Users/sudheesh/Development/Learn/redux-node-app/server
> eslint . --ext .js,.jsx

/Users/sudheesh/Development/Learn/redux-node-app/server/main.js
   8:27  error  Unable to resolve path to module './lib/util/configManager'  import/no-unresolved
   8:27  error  Missing file extension for "./lib/util/configManager"        import/extensions
   9:21  error  Absolute imports should come before relative imports         import/first
  11:17  error  Unable to resolve path to module './lib/util/logger'         import/no-unresolved
  11:17  error  Missing file extension for "./lib/util/logger"               import/extensions
  15:1   error  Split 'const' declarations into multiple statements          one-var
  21:9   error  'host' is already declared in the upper scope                no-shadow
  22:9   error  'port' is already declared in the upper scope                no-shadow

✖ 8 problems (8 errors, 0 warnings)

npm ERR! Darwin 16.3.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "lint"
npm ERR! node v6.9.2
npm ERR! npm  v3.10.9
npm ERR! code ELIFECYCLE
npm ERR! [email protected] lint: `eslint . --ext .js,.jsx`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] lint script 'eslint . --ext .js,.jsx'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the redux-node-app-server package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     eslint . --ext .js,.jsx
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs redux-node-app-server
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls redux-node-app-server
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/sudheesh/Development/Learn/redux-node-app/server/npm-debug.log

Not sure why I get those npm errors in the end.

Thanks,
Sudheesh CM

Brackets Extension Manager doesn't contain latest version

I'm on ubuntu 14.04 using latest brackets Release 1.2 experimental build 1.2.0-15697 (release 8f82e2a97) I installed this plugin with the package manager, and put this .eslintrc file in the root of my project.

but Brackets give me this error in the ESLint console:

ESLint terminated with error: Definition for rule 'comma-dangle' was not found.

removing that line give me this error:

ESLint terminated with error: Definition for rule 'semi-spacing' was not found.

removing both works correctly.
if those are deprecated please update this file to say so, and thanks for this plugin.
and it would be awesome if I could manually run this or set it to run on each save.

Doesn't work with locally installed packages

I wanted to use this with my project, but I use a preset that I install via npm. Because we want to make sure everyone on the project has the same version of the preset, we install it locally as a devDependency. This is the generally recommended best practice.

Unfortunately, brackets-eslint seems to only load packages that have been installed globally. Could it be fixed to load local packages as well?

Unable to load plugins

In my .eslintrc I have this:

plugins:
  - react

And I have the eslint-plugin-react module installed both inside my project root and globally (via `npm install -g eslint-plugin-react). However, brackets-eslint still displays this error:

ESLint terminated with error: Cannot find module 'eslint-plugin-react'

why my brackets complains about it need new version?

When I would like to install this plugin via Extension Manager, it complains about "This extension requires a newer version of Brackets."
FYI, I'm using macOS and install the brackets (version: Release 1.8 build 1.8.0-17108 (alf_localization_release_1.8 3af64fae4) build timestamp: Wed Nov 02 2016 04:47:30 GMT-0700) via brew cask.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.