alloyteam / codeguide Goto Github PK
View Code? Open in Web Editor NEWAlloyteam代码规范
Home Page: http://alloyteam.github.io/CodeGuide/
License: MIT License
Alloyteam代码规范
Home Page: http://alloyteam.github.io/CodeGuide/
License: MIT License
😭
.hidden {
display: none !important;
}
而不是被动等问题发生后,用来取巧, 如:
<div class="content">
<h2 class="heading-sub">...</h2>
</div>
.content h2 {
font-size: 2em;
}
.heading-sub {
font-size: 1.5em !important;
}
README.md has no meaningful data.
http://alloyteam.github.io/CodeGuide/#js-jshint 这个下边
// not good
var singleton = new function() {
var privateVar;
this.publicMethod = function() {
privateVar = 1;
};
this.publicMethod2 = function() {
privateVar = 2;
};
};
请给出建议写法,,
变量命名
标准变量采用驼峰式命名(除了对象的属性外,主要是考虑到cgi返回的数据)
'ID'在变量名中全大写
'URL'在变量名中全大写
'Android'在变量名中大写第一个字母
'iOS'在变量名中小写第一个,大写后两个字母
常量全大写,用下划线连接
构造函数,大写第一个字母
jquery对象必须以'$'开头命名
在团队规范文档中提到的标准变量采用驼峰式命名(除了对象的属性外,主要是考虑到cgi返回的数据)
,想知道什么是cgi
?
既然对象的属性不以驼峰的形式命名,那么是以什么方式命名?
readme 中的 http://alloyteam.github.io 已经无法访问了
// no space before '(', one space before '{', one space between function parameters
var doSomething = function(a, b, c) {
// do something
};
我用standard语法检测插件会提示这样, 要求function名称后面加一个空格.
js-standard Warning Missing space before function parentheses.
虽然我更喜欢不带空格的语法, 问如何关闭着个提示?
你们这个代码的规范是markdown自动生成的,还是手写的样式文件。
我看上面 declaration-order 并没有 flex 布局相关的属性,应该是太久没更新了;
都 2021 年了,估计很少人手写兼容各大平台的 CSS 属性了,都用 autoprefixer 去处理了,所以里面的 -webkit-、-ms- 这些前缀相关的属性是不是可以去掉了。
使用 CSScomb 一键排序的时候发现以上问题
你怎样使用sea.js来规范代码?
在JS文件中生成标签让内容变得更难查找,更难编辑,性能更差。应该尽量避免这种情况的出现。
不完全理解这句,可否描述的更为具体一些,建议怎么来做。
如题。难道是因为ExtJS
通过声明一个明确的字符编码,让浏览器轻松、快速的确定适合网页内容的渲染方式,……
加粗处应改为“快速地”
// need blank line after blocks
var obj = {
foo: function() {
return 1;
},
bar: function() {
return 2;
}
};
// not need blank line when in argument list, array, object
var foo = {
a: 2,
b: function() {
a++;
},
c: 3
};
为什么第一个obj.foo 后面加空行,第二个foo.b后面又没有?
你好 , 看了原文地址 , 有个疑问的地方:
原文地址 :
http://alloyteam.github.io/CodeGuide/#project-naming
关于:
属性简写
右侧有贴出优化的写法方案分别为
/* not good */
.element {
transition: opacity 1s linear 2s;
}
/* good */
.element {
transition-delay: 2s;
transition-timing-function: linear;
transition-duration: 1s;
transition-property: opacity;
}
问题:
虽然结构清晰 , 但是 , 简写的存在不是为了更方便维护代码吗 , 而且文件的大小也会相对应减少 ,why not good 哈
请问,规范页index是怎么打包成一个完整项目的,多谢!
属性应该按照特定的顺序出现以保证易读性;
class
id
name
data-*
src, for, type, href, value , max-length, max, min, pattern
placeholder, title, alt
aria-*, role
required, readonly, disabled
建议修改为
属性应该按照特定的顺序出现以保证易读性;
class
id
name
data-*
src, type, href, value
placeholder, title, alt
for,aria-*, role
required , max-length, max, min, pattern, readonly, disabled
因为for属性应该归类于ARIA
max-length等应该归类于表单校验
eg.
<p style='font-family: "Microsoft YaHei"'>微软雅黑<p>
不使用单引号会导致浏览器错误解析。
感觉失去了sublime应有的轻便
文件/资源命名
在 web 项目中,所有的文件名应该都遵循同一命名约定。以可读性而言,减号(-)是用来分隔文件名的不二之选。同时它也是常见的 URL 分隔符(i.e. //example.com/blog/my-blog-entry or //s.example.com/images/big-black-background.jpg),所以理所当然的,减号应该也是用来分隔资源名称的好选择。
来源: https://github.com/gionkunz/chartist-js/blob/develop/CODINGSTYLE.md
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.