src/component/index.js
Function init
has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring. Open
Open
init: function() {
//cached属性必须定义在组件容器里面,不是template中
var vdom = this.node
this.cacheVm = !!vdom.props.cached
if (vdom.dom && vdom.nodeName === '#comment') {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function init
has 108 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
init: function() {
//cached属性必须定义在组件容器里面,不是template中
var vdom = this.node
this.cacheVm = !!vdom.props.cached
if (vdom.dom && vdom.nodeName === '#comment') {
File index.js
has 302 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import { avalon, isObject, platform } from '../seed/core'
import { cssDiff } from '../directives/css'
import { dumpTree, groupTree, getRange } from '../renders/share'
var legalTags = { wbr: 1, xmp: 1, template: 1 }
var events = 'onInit,onReady,onViewChange,onDispose,onEnter,onLeave'
Function update
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
update: function(vdom, value) {
//this.oldValue = value //★★防止递归
switch (this.readyState) {
case 0:
Avoid deeply nested control flow statements. Open
Open
if (Array.isArray(objectSlot[name])) {
objectSlot[name].push(el)
} else {
objectSlot[name] = [el]
}
Function collectHooks
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
function collectHooks(a, list) {
for (var i in a) {
if (componentEvents[i]) {
if (typeof a[i] === 'function' &&
i.indexOf('on') === 0) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Parsing error: 'import' and 'export' may appear only with 'sourceType: module' Open
Open
import { avalon, isObject, platform } from '../seed/core'
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/