Skip to content

Commit

Permalink
Lint code examples (#1171)
Browse files Browse the repository at this point in the history
* feat: lint configuration

* style: linted documentation

* fix: missing dep
  • Loading branch information
xtuc committed Feb 18, 2017
1 parent fab59d0 commit 881ff13
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 9 deletions.
13 changes: 13 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"extends": "babel",
"rules": {
"no-unused-vars": 1
},
"plugins": [
"markdown"
],
"env": {
"node": true,
"mocha": true
}
}
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ before_install:
- git submodule update --init --recursive

script:
- npm test && bundle exec rake
- npm test && npm run lint && bundle exec rake

git:
submodules: false
Expand Down
2 changes: 1 addition & 1 deletion docs/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Arrow functions **are not** synonymous with normal functions. `arguments` and `t
reference their *outer function* for example:

```javascript
var user = {
const user = {
firstName: "Sebastian",
lastName: "McKenzie",
getFullName: () => {
Expand Down
12 changes: 6 additions & 6 deletions docs/plugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -338,13 +338,13 @@ to learn how to create your own plugins.
The simple plugin that reverses names (from the homepage):

```js
export default function ({types: t}) {
export default function ({ types: t }) {
return {
visitor: {
Identifier(path) {
let name = path.node.name;
const name = path.node.name;
// reverse the name: JavaScript -> tpircSavaJ
path.node.name = name.split('').reverse().join('');
path.node.name = name.split("").reverse().join("");
}
}
};
Expand All @@ -359,11 +359,11 @@ To make your own preset, you just need to export a config.
// Presets can contain other presets, and plugins with options.
module.exports = {
presets: [
require('babel-preset-es2015'),
require("babel-preset-es2015"),
],
plugins: [
[require('babel-plugin-transform-es2015-template-literals'), { spec: true }],
require('babel-plugin-transform-es3-member-expression-literals'),
[require("babel-plugin-transform-es2015-template-literals"), { spec: true }],
require("babel-plugin-transform-es3-member-expression-literals"),
],
};
```
Expand Down
2 changes: 1 addition & 1 deletion docs/usage/polyfill.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ With `webpack.config.js`, add `babel-polyfill` to your entry array:

```js
module.exports = {
entry: ['babel-polyfill', './app/js']
entry: ["babel-polyfill", "./app/js"]
};
```

Expand Down
6 changes: 6 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"scripts": {
"start": "make serve",
"build": "make build",
"lint": "eslint --ext md docs",
"test": "remark _posts docs _includes README.md --quiet"
},
"remarkConfig": {
Expand All @@ -30,7 +31,12 @@
"author": "",
"license": "ISC",
"devDependencies": {
"babel-eslint": "^7.1.1",
"bootstrap-sass": "^3.3.1",
"eslint": "^3.15.0",
"eslint-config-babel": "^6.0.0",
"eslint-plugin-flowtype": "^2.30.0",
"eslint-plugin-markdown": "^1.0.0-beta.3",
"remark-cli": "^2.1.0",
"remark-lint": "^5.2.0",
"remark-preset-lint-recommended": "^1.0.0"
Expand Down

0 comments on commit 881ff13

Please sign in to comment.