Commit 7d7a4752 authored by Robert Schönthal's avatar Robert Schönthal Committed by GitHub
Browse files

Merge pull request #207 from digitalkaoz/feature/coding_styles

use eslint standard coding style
parents c9bfb4da 6576d96a
......@@ -4,8 +4,8 @@ root = true
[*.js]
charset = utf-8
indent_style = tab
indent_size = 8
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
{
"extends": "standard",
"plugins": [
"standard",
"promise"
],
"parser": "babel-eslint",
"env": {
"browser": true
}
}
\ No newline at end of file
java_script:
ignore_file: .javascript_ignore
eslint:
enabled: true
config_file: .eslintrc
scss:
scss_files: "**/*.scss"
# Default severity of all linters.
severity: warning
linters:
BangFormat:
enabled: true
space_before_bang: true
space_after_bang: false
BemDepth:
enabled: false
max_elements: 1
BorderZero:
enabled: true
convention: zero # or `none`
ChainedClasses:
enabled: false
ColorKeyword:
enabled: true
ColorVariable:
enabled: true
Comment:
enabled: true
style: silent
DebugStatement:
enabled: true
DeclarationOrder:
enabled: true
DisableLinterReason:
enabled: false
DuplicateProperty:
enabled: false
ElsePlacement:
enabled: true
style: same_line # or 'new_line'
EmptyLineBetweenBlocks:
enabled: true
ignore_single_line_blocks: true
EmptyRule:
enabled: true
ExtendDirective:
enabled: false
FinalNewline:
enabled: true
present: true
HexLength:
enabled: false
style: short # or 'long'
HexNotation:
enabled: true
style: lowercase # or 'uppercase'
HexValidation:
enabled: true
IdSelector:
enabled: true
ImportantRule:
enabled: true
ImportPath:
enabled: true
leading_underscore: false
filename_extension: false
Indentation:
enabled: true
allow_non_nested_indentation: false
character: space # or 'tab'
width: 2
LeadingZero:
enabled: true
style: include_zero # or 'exclude_zero'
MergeableSelector:
enabled: true
force_nesting: true
NameFormat:
enabled: true
allow_leading_underscore: true
convention: hyphenated_lowercase # or 'camel_case', or 'snake_case', or a regex pattern
NestingDepth:
enabled: true
max_depth: 4
ignore_parent_selectors: false
PlaceholderInExtend:
enabled: false
PrivateNamingConvention:
enabled: false
prefix: _
PropertyCount:
enabled: true
include_nested: false
max_properties: 10
PropertySortOrder:
enabled: true
ignore_unspecified: false
min_properties: 2
separate_groups: false
PropertySpelling:
enabled: true
extra_properties: []
disabled_properties: []
PropertyUnits:
enabled: true
global: [
'em', 'rem', # Font-relative lengths
'px', # Absolute lengths
'vh', 'vw', 'vmin', 'vmax', # Viewport-percentage lengths
'deg', # Angle
'ms', # Duration
'Hz', 'kHz', # Frequency
'dpi', 'dpcm', 'dppx', # Resolution
'%'] # Other
properties: {}
PseudoElement:
enabled: true
QualifyingElement:
enabled: true
allow_element_with_attribute: false
allow_element_with_class: false
allow_element_with_id: false
SelectorDepth:
enabled: true
max_depth: 4
SelectorFormat:
enabled: true
convention: hyphenated_lowercase # or 'strict_BEM', or 'hyphenated_BEM', or 'snake_case', or 'camel_case', or a regex pattern
Shorthand:
enabled: true
allowed_shorthands: [1, 2, 3]
SingleLinePerProperty:
enabled: true
allow_single_line_rule_sets: true
SingleLinePerSelector:
enabled: true
SpaceAfterComma:
enabled: true
style: one_space
SpaceAfterPropertyColon:
enabled: true
style: one_space
SpaceAfterPropertyName:
enabled: false
SpaceAfterVariableColon:
enabled: true
style: one_space
SpaceAfterVariableName:
enabled: false
SpaceAroundOperator:
enabled: true
style: one_space # or 'at_least_one_space', or 'no_space'
SpaceBeforeBrace:
enabled: true
style: space
allow_single_line_padding: false
SpaceBetweenParens:
enabled: true
spaces: 0
StringQuotes:
enabled: true
style: double_quotes
TrailingSemicolon:
enabled: false
TrailingWhitespace:
enabled: true
TrailingZero:
enabled: false
TransitionAll:
enabled: false
UnnecessaryMantissa:
enabled: true
UnnecessaryParentReference:
enabled: true
UrlFormat:
enabled: true
UrlQuotes:
enabled: true
VariableForProperty:
enabled: false
properties: []
VendorPrefix:
enabled: true
identifier_list: base
additional_identifiers: []
excluded_identifiers: []
ZeroUnit:
enabled: true
config_file: .scss-lint.yml
enabled: true
{
"js": {
"indent_size": 2,
"indent_with_tabs": true,
"preserve_newlines": true,
"max_preserve_newlines": 2,
"space_in_paren": false,
"space_after_anon_function": true,
"brace_style": "collapse",
"keep_array_indentation": false,
"keep_function_indentation": false,
"space_before_conditional": true,
"end_with_newline": true,
"end_with_comma": false
},
"scss": {
"indent_size": 2,
"indent_with_tabs": true,
"preserve_newlines": true,
"max_preserve_newlines": 2
}
}
scss_files: "src/scss/**/*.scss"
\ No newline at end of file
......@@ -100,6 +100,13 @@ After successfully installing the above components
Most changes made to files inside the `src` directory will cause the page to reload. This page can also be loaded up on physical devices thanks to BrowserSync.
## Tests
```bash
$ npm run cs:scss //lint all scss files
$ npm run cs:js //lint and fix all js files
$ npm run cs //run both cs jobs
```
## Versioning
For transparency into our release cycle and in striving to maintain backward
......
{
"name": "md-date-time-picker",
"version": "2.2.0",
"version": "2.3.0",
"description": "An implementation of the Material Design Picker components in vanilla CSS, JS and HTML",
"keywords": [
"material",
......@@ -17,7 +17,10 @@
"main": "dist/js/mdDateTimePicker.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"gulp": "gulp"
"gulp": "gulp",
"cs": "npm run cs:js && npm run cs:scss",
"cs:js" : "eslint -c .eslintrc --fix src",
"cs:scss" : "scss-lint"
},
"contributors": [
"Seth Westphal (https://github.com/westy92)",
......@@ -29,6 +32,7 @@
"license": "MIT",
"devDependencies": {
"babel-core": "^6.23.1",
"babel-eslint": "^7.1.1",
"babel-plugin-add-module-exports": "^0.2.1",
"babel-plugin-transform-es2015-modules-umd": "^6.23.0",
"babel-plugin-transform-member-expression-literals": "^6.8.1",
......@@ -39,6 +43,11 @@
"browser-sync": "^2.18.8",
"chokidar": "^1.6.1",
"del": "^2.2.2",
"eslint": "^3.17.1",
"eslint-config-standard": "^7.0.1",
"eslint-plugin-import": "^2.2.0",
"eslint-plugin-promise": "^3.5.0",
"eslint-plugin-standard": "^2.1.1",
"gulp": "^3.9.1",
"gulp-autoprefixer": "^3.1.1",
"gulp-babel": "^6.1.2",
......@@ -56,8 +65,8 @@
"run-sequence": "^1.2.2"
},
"dependencies": {
"moment": "^2.17.1",
"draggabilly": "^2.1.1"
"draggabilly": "^2.1.1",
"moment": "^2.17.1"
},
"repository": {
"type": "git",
......
This diff is collapsed.
if (!Element.prototype.scrollIntoViewIfNeeded) {
Element.prototype.scrollIntoViewIfNeeded = function (centerIfNeeded) {
centerIfNeeded = arguments.length === 0 ? true : !!centerIfNeeded;
centerIfNeeded = arguments.length === 0 ? true : !!centerIfNeeded
var parent = this.parentNode,
parentComputedStyle = window.getComputedStyle(parent, null),
parentBorderTopWidth = parseInt(parentComputedStyle.getPropertyValue('border-top-width')),
parentBorderLeftWidth = parseInt(parentComputedStyle.getPropertyValue('border-left-width')),
overTop = this.offsetTop - parent.offsetTop < parent.scrollTop,
overBottom = (this.offsetTop - parent.offsetTop + this.clientHeight - parentBorderTopWidth) > (parent.scrollTop + parent.clientHeight),
overLeft = this.offsetLeft - parent.offsetLeft < parent.scrollLeft,
overRight = (this.offsetLeft - parent.offsetLeft + this.clientWidth - parentBorderLeftWidth) > (parent.scrollLeft + parent.clientWidth),
alignWithTop = overTop && !overBottom;
let parent = this.parentNode
let parentComputedStyle = window.getComputedStyle(parent, null)
let parentBorderTopWidth = parseInt(parentComputedStyle.getPropertyValue('border-top-width'))
let parentBorderLeftWidth = parseInt(parentComputedStyle.getPropertyValue('border-left-width'))
let overTop = this.offsetTop - parent.offsetTop < parent.scrollTop
let overBottom = (this.offsetTop - parent.offsetTop + this.clientHeight - parentBorderTopWidth) > (parent.scrollTop + parent.clientHeight)
let overLeft = this.offsetLeft - parent.offsetLeft < parent.scrollLeft
let overRight = (this.offsetLeft - parent.offsetLeft + this.clientWidth - parentBorderLeftWidth) > (parent.scrollLeft + parent.clientWidth)
let alignWithTop = overTop && !overBottom
if ((overTop || overBottom) && centerIfNeeded) {
parent.scrollTop = this.offsetTop - parent.offsetTop - parent.clientHeight / 2 - parentBorderTopWidth + this.clientHeight / 2;
parent.scrollTop = this.offsetTop - parent.offsetTop - parent.clientHeight / 2 - parentBorderTopWidth + this.clientHeight / 2
}
if ((overLeft || overRight) && centerIfNeeded) {
parent.scrollLeft = this.offsetLeft - parent.offsetLeft - parent.clientWidth / 2 - parentBorderLeftWidth + this.clientWidth / 2;
parent.scrollLeft = this.offsetLeft - parent.offsetLeft - parent.clientWidth / 2 - parentBorderLeftWidth + this.clientWidth / 2
}
if ((overTop || overBottom || overLeft || overRight) && !centerIfNeeded) {
this.scrollIntoView(alignWithTop);
this.scrollIntoView(alignWithTop)
}
};
}
}
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment