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

Commit 7bafc35

Browse files
authored
Merge pull request #125 from AtomLinter/config-scopes
Make scopes configurable
2 parents 207a035 + 0d34650 commit 7bafc35

File tree

3 files changed

+50
-24
lines changed

3 files changed

+50
-24
lines changed

.travis.yml

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,21 @@
11
# Project specific config
2-
os:
3-
- linux
4-
- osx
5-
6-
env:
7-
matrix:
8-
- ATOM_CHANNEL=stable
9-
- ATOM_CHANNEL=beta
102

113
# Installed for linting the project
124
language: node_js
13-
node_js: "6"
5+
6+
matrix:
7+
include:
8+
- os: linux
9+
env: ATOM_CHANNEL=stable
10+
node_js: "6"
11+
12+
- os: linux
13+
env: ATOM_CHANNEL=beta
14+
node_js: "6"
15+
16+
- os: osx
17+
env: ATOM_CHANNEL=stable
18+
node_js: "6"
1419

1520
# Generic setup follows
1621
script: 'curl -Ls https://github.com/Arcanemagus/ci/raw/atomlinter/build-package.sh | sh'

lib/index.js

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
'use babel';
22

3-
const GRAMMAR_SCOPES = [
4-
'text.html.angular',
5-
'text.html.basic',
6-
'text.html.erb',
7-
'text.html.gohtml',
8-
'text.html.jsp',
9-
'text.html.mustache',
10-
'text.html.ruby'
11-
];
3+
import { CompositeDisposable } from 'atom';
4+
5+
const grammarScopes = [];
126

137
export function activate() {
148
require('atom-package-deps').install('linter-htmlhint');
9+
10+
const subscriptions = new CompositeDisposable();
11+
subscriptions.add(atom.config.observe('linter-htmlhint.enabledScopes', scopes => {
12+
// Remove any old scopes
13+
grammarScopes.splice(0, grammarScopes.length);
14+
// Add the current scopes
15+
Array.prototype.push.apply(grammarScopes, scopes);
16+
}));
1517
}
1618

1719
function getConfig(filePath) {
@@ -38,7 +40,7 @@ function getConfig(filePath) {
3840
export function provideLinter() {
3941
return {
4042
name: 'htmlhint',
41-
grammarScopes: GRAMMAR_SCOPES,
43+
grammarScopes,
4244
scope: 'file',
4345
lintOnFly: true,
4446
lint: editor => {

package.json

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,25 @@
99
"url": "https://github.com/AtomLinter/linter-htmlhint.git"
1010
},
1111
"engines": {
12-
"atom": ">=1.0.0 <2.0.0"
12+
"atom": ">=1.4.0 <2.0.0"
13+
},
14+
"configSchema": {
15+
"enabledScopes": {
16+
"description": "List of scopes to run HTMLHint on, run `Editor: Log Cursor Scope` to determine the scopes for a file.",
17+
"type": "array",
18+
"default": [
19+
"text.html.angular",
20+
"text.html.basic",
21+
"text.html.erb",
22+
"text.html.gohtml",
23+
"text.html.jsp",
24+
"text.html.mustache",
25+
"text.html.ruby"
26+
],
27+
"items": {
28+
"type": "string"
29+
}
30+
}
1331
},
1432
"scripts": {
1533
"test": "apm test",
@@ -40,18 +58,19 @@
4058
"eslintConfig": {
4159
"rules": {
4260
"comma-dangle": [
43-
2,
61+
"error",
4462
"never"
4563
],
46-
"global-require": 0,
64+
"global-require": "off",
4765
"import/no-unresolved": [
48-
2,
66+
"error",
4967
{
5068
"ignore": [
5169
"atom"
5270
]
5371
}
54-
]
72+
],
73+
"import/no-extraneous-dependencies": "off"
5574
},
5675
"extends": "airbnb-base",
5776
"globals": {

0 commit comments

Comments
 (0)