未验证 提交 6dfa1d42 编写于 作者: J Jeff Wang 提交者: GitHub

Eslint precommit (#368)

* Create pre-commit with ESLint

* add vue-eslint-parser

* Add prop-name-casing and script-indent to the eslint rule.

* Update Javascript and Vue files with the proper style

* Comment out ESlint pre-commit first to udpate styles
上级 d64553b6
#!/bin/bash
# if there are no staged changes, we can exit immediately
# this is fast and prevents issues when popping a stash we didn't create
STAGED_CHANGES=`git diff-index --cached HEAD --name-only --diff-filter ACMR`
if [ -z "$STAGED_CHANGES" ]; then
exit 0
fi
# Capture the path to the eslint
cd frontend
ESLINT_EXECUTABLE=$(npm bin)/eslint
cd ..
# Test against with both .js and .vue files
git diff --cached --name-only --diff-filter ACMR | egrep '.(js|vue)$' | xargs $ESLINT_EXECUTABLE --fix
RESULT=$?
[ $RESULT -ne 0 ] && exit 1
exit 0
...@@ -33,3 +33,11 @@ ...@@ -33,3 +33,11 @@
entry: flake8 entry: flake8
language: system language: system
files: \.(py)$ files: \.(py)$
#- repo: local
# hooks:
# - id: eslint-format-checker
# name: eslint-format-checker
# description: Format files with ESLint.
# entry: bash ./.eslint_format.hook
# language: system
...@@ -9,5 +9,7 @@ module.exports = { ...@@ -9,5 +9,7 @@ module.exports = {
// override/add rules settings here, such as: // override/add rules settings here, such as:
'vue/no-unused-vars': 'warn', 'vue/no-unused-vars': 'warn',
'max-len': ["warn", 120], 'max-len': ["warn", 120],
"vue/prop-name-casing": ["error"],
'vue/script-indent': 'error',
} }
} }
...@@ -73,6 +73,7 @@ ...@@ -73,6 +73,7 @@
"stylus": "^0.54.5", "stylus": "^0.54.5",
"stylus-loader": "^3.0.1", "stylus-loader": "^3.0.1",
"url-loader": "^0.5.8", "url-loader": "^0.5.8",
"vue-eslint-parser": "^2.0.3",
"vue-jest": "^1.0.2", "vue-jest": "^1.0.2",
"vue-loader": "^13.3.0", "vue-loader": "^13.3.0",
"vue-style-loader": "^3.0.1", "vue-style-loader": "^3.0.1",
......
...@@ -7,22 +7,22 @@ ...@@ -7,22 +7,22 @@
</template> </template>
<script> <script>
// libs // libs
import echarts from 'echarts'; import echarts from 'echarts';
import { import {
dragMovelHandler, dragMovelHandler,
tansformElement, tansformElement,
relativeMove, relativeMove,
} from './dragHelper'; } from './dragHelper';
// service // service
import {getPluginGraphsGraph} from '../../service'; import {getPluginGraphsGraph} from '../../service';
// https://github.com/taye/interact.js // https://github.com/taye/interact.js
import interact from 'interactjs'; import interact from 'interactjs';
// for d3 drawing // for d3 drawing
import * as d3 from 'd3'; import * as d3 from 'd3';
export default { export default {
props: { props: {
'fitScreen': { 'fitScreen': {
type: Function, type: Function,
...@@ -271,7 +271,7 @@ ...@@ -271,7 +271,7 @@
}); });
}, },
}, },
}; };
</script> </script>
<style lang="stylus"> <style lang="stylus">
.node rect .node rect
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册