Skip to content
This repository was archived by the owner on Sep 6, 2021. It is now read-only.

download eslint package from npm and place it into default extensions - #13108

Merged
saurabh95 merged 10 commits into
masterfrom
zaggino/eslint-integration
Aug 31, 2017
Merged

saurabh95 merged 10 commits into
masterfrom
zaggino/eslint-integration

Conversation

@zaggino

@zaggino zaggino commented Feb 17, 2017

Copy link
Copy Markdown
Contributor

Related to #11984

As a part of this PR I'd like to make a change, that when brackets-eslint is found in extensions/user directory, it won't be loaded from extensions/default directory - I'd like your thoughts on that.

@zaggino zaggino self-assigned this Feb 17, 2017
@ficristo

Copy link
Copy Markdown
Collaborator

I think Atom added a new field in their package.json, packageDependencies, and use it to install their extensions. I think I prefer their approach.
For the linters, I still don't understand what Adobe wants to do...

@zaggino

zaggino commented Feb 17, 2017

Copy link
Copy Markdown
Contributor Author

@ficristo Can you shine a bit more light how these packageDependencies should work here? Happy to make changes to the PR

@ficristo

Copy link
Copy Markdown
Collaborator

I didn't look at Atom implementation, but I think the usage is similar to the node dependencies.
In the package.json of Atom they have something like:

"packageDependencies": {
  "atom-dark-syntax": "0.28.0",
  "atom-dark-ui": "0.53.0",
  "...": "..."
}

We could have something like:

"dependencies": {
  "chokidar": "1.6.0",
  "...": "..."
},
"devDependencies": {
  "grunt": "0.4.5",
  "...": "..."
},
"packageDependencies": {
  "brackets-eslint": "1.0.0",
  "...": "..."
}

and use npm to install them.
If I understood correctly, you have done this but hardcoded the dependencies in the scripts.
I only think we have to move them on the package.json so to make easier to keep track of what we use.
Of course is totally possible there are some drawback that ATM I don't see.

@zaggino
zaggino force-pushed the zaggino/eslint-integration branch from bb72d91 to 3e45509 Compare February 28, 2017 06:43
@zaggino

zaggino commented Feb 28, 2017

Copy link
Copy Markdown
Contributor Author

@ficristo check now

@ficristo

ficristo commented Mar 1, 2017

Copy link
Copy Markdown
Collaborator

I only skimmed the changes. From what I understood ESLint will installed in the default extensions so users will not able to remove this extension. Is it right?
I prefer if this one will be reviewed by someone at Adobe, sorry.

@ficristo
ficristo removed their request for review March 1, 2017 18:17
@zaggino

zaggino commented Mar 1, 2017

Copy link
Copy Markdown
Contributor Author

I don't think that's an issue (same way they can't remove JSLint now nobody really uses), but also a good point, I could make a PR to display default extensions in extension manager and delete them.

@redmunds

redmunds commented Mar 1, 2017

Copy link
Copy Markdown
Contributor

@zaggino Do you mean that default extensions would be physically deleted? That might be problematic from install dir due to permissions, and how would user re-install them?

Another option is to list default extensions in extension manager (possibly in a new tab) and allow them to be disabled/re-enabled.

Note that Brackets has not been tested without the default extensions so different combinations should be tested.

@zaggino

zaggino commented Mar 1, 2017

Copy link
Copy Markdown
Contributor Author

@redmunds Yeah I mean't disable/enable as a configuration preference, not sure why I wrote delete.

If some extensions are critical for Brackets to run, we could hard-code that they can't be disabled, but I think most of them won't cause this sort of problems.

@redmunds

redmunds commented Mar 1, 2017

Copy link
Copy Markdown
Contributor

Very Cool. I don't think any of the default extensions were intended to be critical -- they just haven't been tested to verify it.

@zaggino

zaggino commented Mar 2, 2017

Copy link
Copy Markdown
Contributor Author

ref: #13136

@zaggino

zaggino commented Apr 13, 2017

Copy link
Copy Markdown
Contributor Author

default extensions can be now disabled in the UI, so this can take another look guys

@ficristo

Copy link
Copy Markdown
Collaborator

I was wondering if instead of downloading from npm wouldn't it be better to use brackets registry?

@swmitra

swmitra commented Aug 21, 2017

Copy link
Copy Markdown
Collaborator

@zaggino Great work here 👍 . I took the liberty to resolve the conflicts, as I wanted to test this branch. I looked at the code and it looks good to me. If everything works fine in real usage for a couple of days, I will merge this PR. Do you recall any pending item in this PR which I might have missed?

@zaggino

zaggino commented Aug 21, 2017

Copy link
Copy Markdown
Contributor Author

@swmitra The only thing to consider is that after this, it's higly likely that people will have brackets-eslint as a default extension and also as a user extension installed. Only on of those (the user installed version probably) should load when starting up.

@swmitra

swmitra commented Aug 21, 2017 •

Copy link
Copy Markdown
Collaborator

@zaggino Thanks a lot for quick response 👍 . I will test that scenario more extensively then.

@swmitra

swmitra commented Aug 28, 2017

Copy link
Copy Markdown
Collaborator

I have modified the registration and fetching logic of registered providers a bit based on the following idiom.

  • For a given language, we would be picking up only a single language specific linter + any generic linter registered with '*'
  • Choosing a linter from the registered set of language specific linters depends on priority and load order.

@zaggino @ficristo @petetnt Can you please have a look at this PR urgently? This needs to be in for next release to provide basic es6 support ...

@swmitra

swmitra commented Aug 28, 2017

Copy link
Copy Markdown
Collaborator

I can no longer review this PR, but definitely work on the PR 😄

@swmitra
swmitra removed their request for review August 28, 2017 11:39
@zaggino

zaggino commented Aug 28, 2017

Copy link
Copy Markdown
Contributor Author

I have written most of the code so not much to review.
@swmitra Where's the actual priority being set? The one you use for sorting?

@swmitra

swmitra commented Aug 28, 2017

Copy link
Copy Markdown
Collaborator

The priority field is for future use. As of now it will default to 0 in the priority check and collision resolution will happen on load order.

@swmitra

swmitra commented Aug 28, 2017

Copy link
Copy Markdown
Collaborator

@zaggino I should have been more precise. My mistake. I meant the last commit. As the existing code is already reviewed, I wanted to focus just on the open part to handle conflict between same providers. In the process, I thought of limiting the linting by only a single language specific linter. Looking at both EsLint and JSLint together made me skeptical about the overhead.

@zaggino

zaggino commented Aug 28, 2017

Copy link
Copy Markdown
Contributor Author

Not sure about the single linter, on my projects I use both TypeScript (with TSLint) and ESLint to lint my files. I wouldn't want to have only one.

@swmitra

swmitra commented Aug 29, 2017 •

Copy link
Copy Markdown
Collaborator

@zaggino Thanks for sharing the multiple linter use case. Removed the priority based sorting now. Instead, we now look for providers of a given language having same provider name. If found, remove it and retain the most recently loaded one. Tested with same extension co-existence in Brackets core and user exetensions, and what I have noticed is, user extensions are the ones that used for linting if at all there are any name conflicts.
In case someone wants to disable JSLint, it can be done now by just disabling the JSLint extension under default extensions tab in Extension manager.

@swmitra

swmitra commented Aug 29, 2017

Copy link
Copy Markdown
Collaborator

@petetnt @ficristo Can you please review this PR now? 🙏

@swmitra
swmitra requested a review from ficristo August 29, 2017 08:43
@swmitra

swmitra commented Aug 31, 2017

Copy link
Copy Markdown
Collaborator

@nethip Can you please review this PR? 🙏

@swmitra
swmitra requested a review from nethip August 31, 2017 07:27
Comment thread npm-shrinkwrap.json Outdated
"version": "0.1.4",
"from": "xmldoc@>=0.1.2 <0.2.0",
"resolved": "https://registry.npmjs.org/xmldoc/-/xmldoc-0.1.4.tgz",
"version": "0.1.2",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Version downgrade?

Comment thread npm-shrinkwrap.json Outdated
"version": "0.6.1",
"from": "sax@>=0.6.1 <0.7.0",
"resolved": "https://registry.npmjs.org/sax/-/sax-0.6.1.tgz",
"version": "0.4.2",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this an intended downgrade of the version?

@nethip

nethip commented Aug 31, 2017 •

Copy link
Copy Markdown
Contributor

@swmitra Code wise I am fine. I have taken the liberty in adding check boxes for pending items, so that it is easier to track the progress.

  • Build this branch on all the three platforms (Win, Mac, Linux), locally and see that you are able to succesfully use the www folder, built from this branch.
  • Run smokes on all the platforms, as the library versions have changed for some
  • Trigger installer builds on our build system to see for all the platforms if the build is going fine
  • Have a look out for app footprint size
  • Update documentation wherever required

Update - Library versions are intact now.
Built 'www' size increased by ~400KB
No Documentation update required now. But we have to mention about how to disable JSLint, when releasing Brackets.

@narayani28 narayani28 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@saurabh95
saurabh95 self-requested a review August 31, 2017 15:14
@saurabh95
saurabh95 merged commit 764fb02 into master Aug 31, 2017

@petetnt petetnt left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW LGTM, bit too late though. Nice work!

@petetnt
petetnt deleted the zaggino/eslint-integration branch August 31, 2017 21:37
ficristo pushed a commit to quadre-code/quadre that referenced this pull request Nov 26, 2017
…adobe#13108)

* download eslint package from npm and place it into default extensions

* add defaultExtensions section to package.json

* lock deps, add shrinkwrap again

* do not lint brackets-eslint files

* Handle multiple linters for a specific language using priority and load order

* Handle provider name conflict for a given language by retaining the most recently loaded one

* Remove invalid comment

* Update npm-shrinkwrap.json
ficristo pushed a commit to quadre-code/quadre that referenced this pull request Nov 26, 2017
…adobe#13108)

* download eslint package from npm and place it into default extensions

* add defaultExtensions section to package.json

* lock deps, add shrinkwrap again

* do not lint brackets-eslint files

* Handle multiple linters for a specific language using priority and load order

* Handle provider name conflict for a given language by retaining the most recently loaded one

* Remove invalid comment

* Update npm-shrinkwrap.json
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants