eslint-plugin-nuxt
Advanced tools
Comparing version 0.5.0 to 0.5.1
@@ -5,2 +5,14 @@ # Changelog | ||
### [0.5.1](https://github.com/nuxt/eslint-plugin-nuxt/compare/v0.5.0...v0.5.1) (2020-02-09) | ||
### Features | ||
* **rule:** add require-func-head in recommended ([#62](https://github.com/nuxt/eslint-plugin-nuxt/issues/62)) ([7d0926f](https://github.com/nuxt/eslint-plugin-nuxt/commit/7d0926f4a73bbd3c91496f7ab8e0fc232f38d423)) | ||
### Bug Fixes | ||
* correct category for no-timing-in-fetch-data ([bbf6ce9](https://github.com/nuxt/eslint-plugin-nuxt/commit/bbf6ce985b0e40c1c9450fd3b3a7188d3a7a214a)) | ||
## [0.5.0](https://github.com/nuxt/eslint-plugin-nuxt/compare/v0.4.3...v0.5.0) (2019-11-09) | ||
@@ -7,0 +19,0 @@ |
module.exports = { | ||
extends: require.resolve('./base.js'), | ||
rules: { | ||
'nuxt/no-timing-in-fetch-data': 'error' | ||
'nuxt/no-timing-in-fetch-data': 'error', | ||
'nuxt/require-func-head': 'error' | ||
} | ||
} |
@@ -8,3 +8,4 @@ module.exports = { | ||
'no-timing-in-fetch-data': require('./rules/no-timing-in-fetch-data'), | ||
'no-cjs-in-config': require('./rules/no-cjs-in-config') | ||
'no-cjs-in-config': require('./rules/no-cjs-in-config'), | ||
'require-func-head': require('./rules/require-func-head') | ||
}, | ||
@@ -11,0 +12,0 @@ configs: { |
@@ -17,3 +17,3 @@ /** | ||
description: 'disallow `setTimeout/setInterval` in `asyncData/fetch`', | ||
category: 'base' | ||
category: 'recommended' | ||
}, | ||
@@ -20,0 +20,0 @@ messages: { |
@@ -46,2 +46,24 @@ const utils = require('eslint-plugin-vue/lib/utils') | ||
} | ||
}, | ||
isOpenParen (token) { | ||
return token.type === 'Punctuator' && token.value === '(' | ||
}, | ||
isCloseParen (token) { | ||
return token.type === 'Punctuator' && token.value === ')' | ||
}, | ||
getFirstAndLastTokens (node, sourceCode) { | ||
let first = sourceCode.getFirstToken(node) | ||
let last = sourceCode.getLastToken(node) | ||
// If the value enclosed by parentheses, update the 'first' and 'last' by the parentheses. | ||
while (true) { | ||
const prev = sourceCode.getTokenBefore(first) | ||
const next = sourceCode.getTokenAfter(last) | ||
if (this.isOpenParen(prev) && this.isCloseParen(next)) { | ||
first = prev | ||
last = next | ||
} else { | ||
return { first, last } | ||
} | ||
} | ||
} | ||
@@ -48,0 +70,0 @@ }, |
{ | ||
"name": "eslint-plugin-nuxt", | ||
"version": "0.5.0", | ||
"version": "0.5.1", | ||
"description": "ESLint plugin for Nuxt.js", | ||
@@ -41,17 +41,17 @@ "author": "Clark Du <clarkdo@gmail.com>", | ||
"devDependencies": { | ||
"eslint": "^6.6.0", | ||
"eslint": "^6.8.0", | ||
"eslint-config-standard": "^14.1.0", | ||
"eslint-plugin-import": "^2.18.2", | ||
"eslint-plugin-node": "^10.0.0", | ||
"eslint-plugin-import": "^2.20.1", | ||
"eslint-plugin-node": "^11.0.0", | ||
"eslint-plugin-promise": "^4.2.1", | ||
"eslint-plugin-standard": "^4.0.1", | ||
"husky": "^3.0.9", | ||
"jest": "^24.9.0", | ||
"lint-staged": "^9.4.2", | ||
"standard-version": "^7.0.0" | ||
"husky": "^4.2.1", | ||
"jest": "^25.1.0", | ||
"lint-staged": "^10.0.7", | ||
"standard-version": "^7.1.0" | ||
}, | ||
"dependencies": { | ||
"eslint-plugin-vue": "^6.0.0", | ||
"eslint-plugin-vue": "^6.1.2", | ||
"vue-eslint-parser": "^7.0.0" | ||
} | ||
} |
@@ -105,2 +105,3 @@ # eslint-plugin-nuxt | ||
|:---|:--------|:------------| | ||
| :wrench: | [nuxt/no-timing-in-fetch-data](./docs/rules/no-timing-in-fetch-data.md) | Disallow `setTimeout/setInterval` in `asyncData/fetch` | | ||
| | [nuxt/no-timing-in-fetch-data](./docs/rules/no-timing-in-fetch-data.md) | Disallow `setTimeout/setInterval` in `asyncData/fetch` | | ||
| | [nuxt/require-func-head](./docs/rules/require-func-head.md) | Enforce `head` property in component to be a function. | |
27522
18
583
107
Updatedeslint-plugin-vue@^6.1.2