ecomfe / eslint-plugin-san Goto Github PK
View Code? Open in Web Editor NEWHome Page: https://ecomfe.github.io/eslint-plugin-san
License: Other
Home Page: https://ecomfe.github.io/eslint-plugin-san
License: Other
在该 san/order-in-components 规则下,san 组件中自定义的成员方法在 checkOrder 的排序检测方法中没有相应的处理。
在默认配置下,如有下列属性,排序检测是符合预期的:
['template', 'initData', 'attached']
但是,当为 san 组件自定义了成员方法,由于 getOrderPosition 方法在 orderMap 中没有记录或配置,那么就不会被正确检测。比如['template', 'customMethod1', 'customMethod2', 'initData', 'attached']
,示例:
主要代码逻辑:
https://github.com/ecomfe/eslint-plugin-san/blob/main/lib/rules/order-in-components.js#L51
https://github.com/ecomfe/eslint-plugin-san/blob/main/lib/rules/order-in-components.js#L221
期望的结果是,开发者自定义的成员方法,应该独立形成一个 group
,在定义的 order
指定位置处参与排序检测,group
内部可以支持 alpabeta
排序,类似san/attributes-order
规则。
提议配置规则添加 CUSTOM_METHODS
,指代自定义的成员方法,示例:
{
"san/order-in-components": ["error", {
"order": [
// 视图
"template",
"components",
"trimWhitespace",
// 事件
"messages",
// 数据
"dataTypes",
"computed",
"filters",
"initData",
// 生命周期
"LIFECYCLE_HOOKS",
// 自定义的成员方法
"CUSTOM_METHODS"
]
}]
}
下面语法在 ssr 中是不允许的:
<custom-copm prop="{{+a}}" />
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.