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

Commit 8090f33

Browse files
committed
Lint code using JavaScript Standard Style
1 parent b96624a commit 8090f33

File tree

2 files changed

+42
-0
lines changed

2 files changed

+42
-0
lines changed

package.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,25 @@
1717
"dependencies": {
1818
"atom-languageclient": "^0.6.3"
1919
},
20+
"devDependencies": {
21+
"snazzy": "^7.0.0",
22+
"standard": "^10.0.3"
23+
},
24+
"standard": {
25+
"globals": [
26+
"afterEach",
27+
"atom",
28+
"beforeEach",
29+
"describe",
30+
"expect",
31+
"it",
32+
"jasmine",
33+
"runs",
34+
"spyOn",
35+
"waitsFor",
36+
"waitsForPromise"
37+
]
38+
},
2039
"enhancedScopes": [
2140
"source.c",
2241
"source.cpp"

script/lint

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/usr/bin/env bash
2+
3+
# Exit on failure, and treat expansion of unset variables as an error.
4+
set -eu
5+
6+
lint() {
7+
local npm_bin=$( npm bin )
8+
local paths="$1"
9+
10+
"${npm_bin}/standard" --verbose "${paths}" | "${npm_bin}/snazzy"
11+
}
12+
13+
main() {
14+
local script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd -P )"
15+
local source_dir=$( dirname "${script_dir}" )
16+
17+
local -i status=0
18+
echo "Linting package..." && lint "${source_dir}/lib/**/*.js" || status=$?
19+
echo "Linting package specs..." && lint "${source_dir}/spec/**/*.js" || status=$?
20+
return ${status}
21+
}
22+
23+
main "$@"

0 commit comments

Comments
 (0)