Skip to content
This repository has been archived by the owner on Aug 7, 2023. It is now read-only.

Make scopes a configuration setting #629

Merged
merged 6 commits into from
Jul 7, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,14 @@ module.exports = {
this.subscriptions = new _atom.CompositeDisposable();
this.active = true;
this.worker = null;
this.scopes = ['source.js', 'source.jsx', 'source.js.jsx', 'source.babel', 'source.js-semantic'];
this.scopes = [];

this.subscriptions.add(atom.config.observe('linter-eslint.scopes', function (scopes) {
// Remove any old scopes
_this.scopes.splice(0, _this.scopes.length);
// Add the current scopes
Array.prototype.push.apply(_this.scopes, scopes);
}));
var embeddedScope = 'source.js.embedded.html';
this.subscriptions.add(atom.config.observe('linter-eslint.lintHtmlFiles', function (lintHtmlFiles) {
if (lintHtmlFiles) {
Expand Down
14 changes: 14 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,20 @@
"description": "Have eslint attempt to fix some errors automatically when saving the file.",
"type": "boolean",
"default": false
},
"scopes": {
"title": "List of scopes to run ESLint on, run `Editor: Log Cursor Scope` to determine the scopes for a file.",
"type": "array",
Copy link
Member

Choose a reason for hiding this comment

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

Add a description along the lines of this describing what this setting does, and how the user can get the information to update it.

"default": [
"source.js",
"source.jsx",
"source.js.jsx",
"source.babel",
"source.js-semantic"
],
"items": {
"type": "string"
}
}
},
"scripts": {
Expand Down
8 changes: 7 additions & 1 deletion src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,14 @@ module.exports = {
this.subscriptions = new CompositeDisposable()
this.active = true
this.worker = null
this.scopes = ['source.js', 'source.jsx', 'source.js.jsx', 'source.babel', 'source.js-semantic']
this.scopes = []

this.subscriptions.add(atom.config.observe('linter-eslint.scopes', scopes => {
// Remove any old scopes
this.scopes.splice(0, this.scopes.length)
// Add the current scopes
Array.prototype.push.apply(this.scopes, scopes)
}))
const embeddedScope = 'source.js.embedded.html'
this.subscriptions.add(atom.config.observe('linter-eslint.lintHtmlFiles', lintHtmlFiles => {
if (lintHtmlFiles) {
Expand Down