Skip to content

Commit

Permalink
Run eslint on tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pablopunk committed Jan 24, 2021
1 parent 5d77269 commit 90f609c
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
1 change: 1 addition & 0 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ extends: 'eslint:recommended'
parserOptions:
ecmaVersion: 12
sourceType: module
ignorePatterns: ['template/']
rules: {}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ _miny_ comes with `prettier` built-in to automatically format your code on every

It's also useful to use an actual linter for catching some bugs or not used code, so it also includes `eslint` to lint all your code and help you fixing potential bugs.

You can customize the rules it follows by modifying the section `prettier` in `package.json`. By default, it will use _2 spaces as tabs_, remove unnecessary semicolons and convert double quoutes to _single quoutes_. You can add/remove [all of these rules](https://prettier.io/docs/en/options.html). You can also edit the `eslint` rules in `.eslintrc.yml`. Take a look at [eslint docs](https://eslint.org/docs/user-guide/configuring).
You can customize the rules it follows by modifying the section `prettier` in `package.json`. By default, it will use _2 spaces as tabs_, remove unnecessary semicolons and convert double quoutes to _single quoutes_. You can add/remove [all of these rules](https://prettier.io/docs/en/options.html). You can also edit the `eslint` rules in `.eslintrc.yml`. Take a look at [eslint docs](https://eslint.org/docs/user-guide/configuring). Runnning `npm run lint` will run both prettier and eslint in your project. There's also a `lint-fix` npm script that can help fixing trivial errors.

### Offline

Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@
"url": "https://github.com/pablopunk/miny"
},
"scripts": {
"test": "ava"
"lint": "eslint --ext .js .",
"lint-fix": "eslint --fix --ext .js .",
"test": "npm run lint && ava"
}
}
7 changes: 5 additions & 2 deletions template/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
<% } %>
"prettier": "*",
"pretty-quick": "*",
"husky": "*"
"husky": "*",
"eslint": "*"
},
"homepage": "<%- githubRepo %>",
"keywords": [ <%- `${keywords.trim().split(/[, ]+/).map(k => `"${k.trim()}"`).join(', ')}` %> ],
Expand All @@ -36,8 +37,10 @@
"url": "<%- githubRepo %>"
},
"scripts": {
"lint": "eslint --ext .js .",
"lint-fix": "eslint --fix --ext .js .",
<% if (test !== 'none') { %>
"test": "<%- test -%>"
"test": "npm run lint && <%- test -%>"
<% } %>
}
}

0 comments on commit 90f609c

Please sign in to comment.