react-codemod-lint-fix
This commit is contained in:
parent
b4b028dec0
commit
f53b960741
|
@ -33,7 +33,7 @@ module.exports = function(j) {
|
||||||
type: 'ImportDeclaration',
|
type: 'ImportDeclaration',
|
||||||
source: {
|
source: {
|
||||||
type: 'Literal',
|
type: 'Literal',
|
||||||
}
|
},
|
||||||
})
|
})
|
||||||
.filter(declarator => declarator.value.source.value === module)
|
.filter(declarator => declarator.value.source.value === module)
|
||||||
.size() === 1
|
.size() === 1
|
||||||
|
@ -60,8 +60,8 @@ module.exports = function(j) {
|
||||||
path.find(j.ExportDefaultDeclaration, {
|
path.find(j.ExportDefaultDeclaration, {
|
||||||
declaration: {
|
declaration: {
|
||||||
type: 'CallExpression',
|
type: 'CallExpression',
|
||||||
callee: REACT_CREATE_CLASS_MEMBER_EXPRESSION
|
callee: REACT_CREATE_CLASS_MEMBER_EXPRESSION,
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const findReactCreateClassModuleExports = path =>
|
const findReactCreateClassModuleExports = path =>
|
||||||
|
@ -124,7 +124,7 @@ module.exports = function(j) {
|
||||||
// Others
|
// Others
|
||||||
const getReactCreateClassSpec = classPath => {
|
const getReactCreateClassSpec = classPath => {
|
||||||
var {value} = classPath;
|
var {value} = classPath;
|
||||||
const spec = (value.init || value.right || value.declaration).arguments[0];
|
const spec = (value.init || value.right || value.declaration).arguments[0];
|
||||||
if (spec.type === 'ObjectExpression' && Array.isArray(spec.properties)) {
|
if (spec.type === 'ObjectExpression' && Array.isArray(spec.properties)) {
|
||||||
return spec;
|
return spec;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue