Skip to content

Commit 9b28ef0

Browse files
authored
Switch standard to eslint (with standard config) (#174)
* Add base eslintrc * Add deps * Update pre-commit hook * Update all scripts * Update docs * Fix lint
1 parent 73ae51e commit 9b28ef0

File tree

39 files changed

+67
-66
lines changed

39 files changed

+67
-66
lines changed

.eslintrc.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
module.exports = {
2+
extends: [
3+
'standard'
4+
],
5+
ignorePatterns: ['**/dist/**'],
6+
env: {
7+
browser: true,
8+
es2021: true,
9+
node: true
10+
}
11+
}

.pre-commit-config.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
repos:
2-
- repo: https://github.com/standard/standard
3-
rev: v16.0.3
4-
hooks:
5-
- id: standard
2+
- repo: https://github.com/pre-commit/mirrors-eslint
3+
rev: v7.32.0
4+
hooks:
5+
- id: eslint

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ npm run build --workspace "@resonate/rangeslider"
199199

200200
## Testing
201201

202-
Run all tests (standard, dependency-check)
202+
Run all tests (lint, dependency-check)
203203

204204
```sh
205205
npm test
@@ -227,8 +227,9 @@ Command | Description |
227227

228228
## Code style
229229

230-
We use [standard](https://standardjs.com/) as a linter and javascript style guide.
231-
Make sure to add appropriate plugin for your editor (see: [standard#are-there-text-editor-plugins](https://github.com/standard/standard#are-there-text-editor-plugins)) or install a [pre-commit hook](https://standardjs.com/#use-a-pre-commit-hook) (see `.pre-commit-config.yaml`) to automatically apply the standard style.
230+
We use [eslint](https://eslint.org/) together with the [standard](https://standardjs.com/) config as a linter and javascript style guide.
231+
Make sure to add appropriate plugin for your editor, unless it is already supported out-of-box.
232+
It can also be handy to install the [pre-commit hook](https://pre-commit.com/) (see `.pre-commit-config.yaml`) to automatically apply the standard style.
232233

233234
## Maintainers
234235

beta/package.json

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
"dev": "cd src && jalla start index.js --watch --sw sw.js",
99
"audit:npm": "npm audit",
1010
"start": "NODE_ENV=production jalla serve index.js --dir dist --sw sw.js",
11-
"test": "standard && npm run test:deps",
11+
"test": "run-s test:lint test:deps",
12+
"test:lint": "eslint .",
1213
"test:deps": "dependency-check ./src/index.js -i @resonate/tachyons --no-dev",
1314
"test:browser": "browserify src/test/browser/index.js | tape-run | tap-format-spec"
1415
},
@@ -46,11 +47,6 @@
4647
"postcss-custom-media": {}
4748
}
4849
},
49-
"standard": {
50-
"ignore": [
51-
"/dist/**/*.js"
52-
]
53-
},
5450
"license": "GPL-3.0-or-later",
5551
"dependencies": {
5652
"@resonate/api-factory-generator": "*",

beta/src/components/topup-credits/index.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,11 @@ class Credits extends Component {
113113
try {
114114
const response = this.local.intent
115115
? await state.api.payments.updateIntent({
116-
uid: state.user.uid,
117-
pi: this.local.intent.id,
118-
tokens: this.local.data.tokens,
119-
currency: this.local.currency
120-
})
116+
uid: state.user.uid,
117+
pi: this.local.intent.id,
118+
tokens: this.local.data.tokens,
119+
currency: this.local.currency
120+
})
121121
: await state.api.payments.createIntent({
122122
uid: state.user.uid,
123123
tokens: this.local.data.tokens,

embed/package.json

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
"private": true,
55
"scripts": {
66
"build": "NODE_ENV=production jalla build index.js --dir dist --base /embed",
7-
"inspect": "jalla inspect index.js",
87
"start": "NODE_ENV=production jalla serve index.js --dir dist --base /embed",
98
"dev": "jalla index.js --base /embed",
109
"audit:npm": "npm audit",
11-
"test": "standard && npm run test-deps",
12-
"test-browser": "browserify -t [babelify] test/browser/index.js | tape-run --port 5000 --keep-open | tap-format-spec",
13-
"test-deps": "dependency-check . -i @resonate/tachyons --no-dev"
10+
"test": "run-s test:lint test:deps",
11+
"test:lint": "eslint .",
12+
"test:browser": "browserify -t [babelify] test/browser/index.js | tape-run --port 5000 --keep-open | tap-format-spec",
13+
"test:deps": "dependency-check . -i @resonate/tachyons --no-dev"
1414
},
1515
"browser": {
1616
"assert": "nanoassert"
@@ -48,11 +48,6 @@
4848
"postcss-custom-media": {}
4949
}
5050
},
51-
"standard": {
52-
"ignore": [
53-
"/dist/**/*.js"
54-
]
55-
},
5651
"license": "gpl3",
5752
"dependencies": {
5853
"@resonate/api-factory-generator": "*",

package.json

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,6 @@
1717
"embed",
1818
"beta"
1919
],
20-
"standard": {
21-
"ignore": [
22-
"**/lib/**"
23-
]
24-
},
2520
"dependencies": {
2621
"@babel/core": "^7.15.8",
2722
"@babel/node": "^7.15.8",
@@ -37,9 +32,12 @@
3732
"postcss-nested": "^4.1.2",
3833
"postcss-preset-env": "^6.6.0",
3934
"postcss-reporter": "^6.0.1",
40-
"sheetify-postcss": "^2.0.0",
41-
"standard": "^16.0.4",
4235
"tape": "^5.3.1",
4336
"tape-run": "^9.0.0"
37+
},
38+
"devDependencies": {
39+
"eslint": "^7.32.0",
40+
"eslint-config-standard": "^16.0.3",
41+
"npm-run-all": "^4.1.5"
4442
}
4543
}

packages/api-factory-generator/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"test": "test"
88
},
99
"scripts": {
10-
"test": "standard && dependency-check .",
10+
"test": "eslint . && dependency-check .",
1111
"test:browser": "browserify -t [babelify] test/index.js | tape-run --port 5000 --keep-open | tap-format-spec"
1212
},
1313
"keywords": [

packages/api-service/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"description": "API Service Swagger Client Loader",
55
"main": "index.js",
66
"scripts": {
7-
"test": "standard && dependency-check ."
7+
"test": "eslint . && dependency-check ."
88
},
99
"keywords": [
1010
"api",

packages/artwork-component/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"description": "Artwork component",
55
"main": "index.js",
66
"scripts": {
7-
"test": "standard && dependency-check ."
7+
"test": "eslint . && dependency-check ."
88
},
99
"keywords": [
1010
"nanocomponent"

0 commit comments

Comments
 (0)