Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
凌波微步_大先生
dashboard
提交
c1f748f3
D
dashboard
项目概览
凌波微步_大先生
/
dashboard
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dashboard
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
c1f748f3
编写于
10月 27, 2015
作者:
A
azakrzewski
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #25 from kubernetes/eslint
Wire ESlint with the project and fix its errors
上级
0555f9b1
bf446ec8
变更
15
隐藏空白更改
内联
并排
Showing
15 changed file
with
81 addition
and
67 deletion
+81
-67
.eslintrc
.eslintrc
+10
-3
build/.eslintrc
build/.eslintrc
+4
-0
build/backend.js
build/backend.js
+5
-5
build/build.js
build/build.js
+3
-6
build/conf.js
build/conf.js
+12
-11
build/index.js
build/index.js
+4
-4
build/karma.conf.js
build/karma.conf.js
+7
-7
build/protractor.conf.js
build/protractor.conf.js
+2
-2
build/script.js
build/script.js
+11
-12
build/serve.js
build/serve.js
+5
-5
build/style.js
build/style.js
+4
-4
build/test.js
build/test.js
+2
-2
src/app/frontend/.eslintrc
src/app/frontend/.eslintrc
+7
-1
src/app/frontend/index.module.js
src/app/frontend/index.module.js
+4
-4
src/app/frontend/index.route.js
src/app/frontend/index.route.js
+1
-1
未找到文件。
.eslintrc
浏览文件 @
c1f748f3
...
...
@@ -10,10 +10,17 @@
"extends": "eslint:recommended",
"env": {
// Enables all ES6 features except modules.
"es6": true
"es6": true
,
},
"ecmaFeatures": {
// Enable ES6 modules to have all language features covered.
"modules": true
}
"modules": true,
},
"rules": {
// Require dangling comma at the end of any multiline list/object. This is to be consistent
// with backend code.
"comma-dangle": [2, "always-multiline"],
// No spacing in object literals nor in imports/exports.
"object-curly-spacing": [2, "never"],
},
}
build/.eslintrc
浏览文件 @
c1f748f3
...
...
@@ -2,5 +2,9 @@
"env": {
// Build files are written in node.
"node": true
},
"rules": {
// This folder contains Node code, so using console is fine.
"no-console": 0
}
}
build/backend.js
浏览文件 @
c1f748f3
...
...
@@ -31,7 +31,7 @@ import conf from './conf';
*/
const
goBackendDependencies
=
[
'
github.com/golang/glog
'
,
'
github.com/spf13/pflag
'
'
github.com/spf13/pflag
'
,
];
...
...
@@ -45,7 +45,7 @@ const goBackendDependencies = [
*/
function
spawnGoProcess
(
args
,
doneFn
,
opt_env
)
{
var
goTask
=
child
.
spawn
(
'
go
'
,
args
,
{
env
:
lodash
.
merge
(
process
.
env
,
{
GOPATH
:
conf
.
paths
.
backendTmp
},
opt_env
||
{})
env
:
lodash
.
merge
(
process
.
env
,
{
GOPATH
:
conf
.
paths
.
backendTmp
},
opt_env
||
{})
,
});
// Call Gulp callback on task exit. This has to be done to make Gulp dependency management
...
...
@@ -76,7 +76,7 @@ gulp.task('backend', ['backend-dependencies'], function(doneFn) {
spawnGoProcess
([
'
build
'
,
'
-o
'
,
path
.
join
(
conf
.
paths
.
serve
,
'
console
'
),
path
.
join
(
conf
.
paths
.
backendSrc
,
'
console.go
'
)
path
.
join
(
conf
.
paths
.
backendSrc
,
'
console.go
'
)
,
],
doneFn
);
});
...
...
@@ -98,12 +98,12 @@ gulp.task('backend:prod', ['backend-dependencies'], function(doneFn) {
'
-a
'
,
'
-installsuffix
'
,
'
cgo
'
,
'
-o
'
,
outputBinaryPath
,
path
.
join
(
conf
.
paths
.
backendSrc
,
'
console.go
'
)
path
.
join
(
conf
.
paths
.
backendSrc
,
'
console.go
'
)
,
],
doneFn
,
{
// Disable cgo package. Required to run on scratch docker image.
CGO_ENABLED
:
'
0
'
,
// Scratch docker image is linux.
GOOS
:
'
linux
'
GOOS
:
'
linux
'
,
});
},
function
(
error
)
{
doneFn
(
error
);
...
...
build/build.js
浏览文件 @
c1f748f3
...
...
@@ -17,9 +17,7 @@
*/
import
del
from
'
del
'
;
import
gulp
from
'
gulp
'
;
import
gulpEslint
from
'
gulp-eslint
'
;
import
gulpFilter
from
'
gulp-filter
'
;
import
gulpInject
from
'
gulp-inject
'
;
import
gulpMinifyCss
from
'
gulp-minify-css
'
;
import
gulpMinifyHtml
from
'
gulp-minify-html
'
;
import
gulpUglify
from
'
gulp-uglify
'
;
...
...
@@ -27,7 +25,6 @@ import gulpUseref from 'gulp-useref';
import
gulpRev
from
'
gulp-rev
'
;
import
gulpRevReplace
from
'
gulp-rev-replace
'
;
import
gulpSize
from
'
gulp-size
'
;
import
gulpSourcemaps
from
'
gulp-sourcemaps
'
;
import
uglifySaveLicense
from
'
uglify-save-license
'
;
import
path
from
'
path
'
;
...
...
@@ -55,8 +52,8 @@ gulp.task('build', ['index:prod', 'assets'], function () {
// To resolve local paths.
conf
.
paths
.
prodTmp
,
// To resolve bower_components/... paths.
conf
.
paths
.
base
]
conf
.
paths
.
base
,
]
,
}))
.
pipe
(
vendorCssFilter
)
.
pipe
(
gulpMinifyCss
())
...
...
@@ -72,7 +69,7 @@ gulp.task('build', ['index:prod', 'assets'], function () {
.
pipe
(
gulpMinifyHtml
({
empty
:
true
,
spare
:
true
,
quotes
:
true
quotes
:
true
,
}))
.
pipe
(
htmlFilter
.
restore
)
.
pipe
(
gulp
.
dest
(
conf
.
paths
.
dist
))
...
...
build/conf.js
浏览文件 @
c1f748f3
...
...
@@ -28,6 +28,16 @@ const basePath = path.join(__dirname, '../');
* Exported configuration object with common constants used in build pipeline.
*/
export
default
{
/**
* Frontend application constants.
*/
frontend
:
{
/**
* The name of the root Angular module, i.e., the module that bootstraps the application.
*/
rootModuleName
:
'
kubernetesConsole
'
,
},
/**
* Absolute paths to known directories, e.g., to source directory.
*/
...
...
@@ -39,6 +49,7 @@ export default {
backendTmp
:
path
.
join
(
basePath
,
'
.tmp/backend
'
),
bowerComponents
:
path
.
join
(
basePath
,
'
bower_components
'
),
build
:
path
.
join
(
basePath
,
'
build
'
),
deploySrc
:
path
.
join
(
basePath
,
'
src/app/deploy
'
),
dist
:
path
.
join
(
basePath
,
'
dist
'
),
externs
:
path
.
join
(
basePath
,
'
src/app/externs
'
),
frontendSrc
:
path
.
join
(
basePath
,
'
src/app/frontend
'
),
...
...
@@ -51,16 +62,6 @@ export default {
protractorConf
:
path
.
join
(
basePath
,
'
build/protractor.conf.js
'
),
serve
:
path
.
join
(
basePath
,
'
.tmp/serve
'
),
src
:
path
.
join
(
basePath
,
'
src
'
),
tmp
:
path
.
join
(
basePath
,
'
.tmp
'
)
tmp
:
path
.
join
(
basePath
,
'
.tmp
'
)
,
},
/**
* Frontend application constants.
*/
frontend
:
{
/**
* The name of the root Angular module, i.e., the module that bootstraps the application.
*/
rootModuleName
:
'
kubernetesConsole
'
}
};
build/index.js
浏览文件 @
c1f748f3
...
...
@@ -30,20 +30,20 @@ import conf from './conf';
* @param {string} indexPath
*/
function
createIndexFile
(
indexPath
)
{
let
injectStyles
=
gulp
.
src
(
path
.
join
(
indexPath
,
'
**/*.css
'
),
{
read
:
false
});
let
injectStyles
=
gulp
.
src
(
path
.
join
(
indexPath
,
'
**/*.css
'
),
{
read
:
false
});
let
injectScripts
=
gulp
.
src
(
path
.
join
(
indexPath
,
'
**/*.js
'
),
{
read
:
false
});
let
injectScripts
=
gulp
.
src
(
path
.
join
(
indexPath
,
'
**/*.js
'
),
{
read
:
false
});
let
injectOptions
=
{
// Make the dependencies relative to the deps directory.
ignorePath
:
[
path
.
relative
(
conf
.
paths
.
base
,
indexPath
)],
addRootSlash
:
false
,
quiet
:
true
quiet
:
true
,
};
let
wiredepOptions
=
{
// Make wiredep dependencies begin with "bower_components/" not "../../...".
ignorePath
:
path
.
relative
(
conf
.
paths
.
frontendSrc
,
indexPath
)
+
'
/
'
ignorePath
:
path
.
relative
(
conf
.
paths
.
frontendSrc
,
indexPath
)
+
'
/
'
,
};
return
gulp
.
src
(
path
.
join
(
conf
.
paths
.
frontendSrc
,
'
index.html
'
))
...
...
build/karma.conf.js
浏览文件 @
c1f748f3
...
...
@@ -33,14 +33,14 @@ function getFileList() {
// All app dependencies are required for tests. Include them.
let
wiredepOptions
=
{
dependencies
:
true
,
devDependencies
:
true
devDependencies
:
true
,
};
return
wiredep
(
wiredepOptions
).
js
.
concat
([
path
.
join
(
conf
.
paths
.
frontendTest
,
'
**/*.js
'
),
path
.
join
(
conf
.
paths
.
frontendSrc
,
'
**/*.js
'
),
path
.
join
(
conf
.
paths
.
frontendSrc
,
'
**/*.html
'
)
path
.
join
(
conf
.
paths
.
frontendSrc
,
'
**/*.html
'
)
,
]);
}
...
...
@@ -71,7 +71,7 @@ export default function(config) {
'
karma-jasmine
'
,
'
karma-ng-html2js-preprocessor
'
,
'
karma-sourcemap-loader
'
,
'
karma-browserify
'
'
karma-browserify
'
,
],
// karma-browserify plugin config.
...
...
@@ -82,15 +82,15 @@ export default function(config) {
paths
:
[
conf
.
paths
.
frontendSrc
,
conf
.
paths
.
frontendTest
],
transform
:
[
// Transform ES6 code into ES5 so that browsers can digest it.
'
babelify
'
]
'
babelify
'
,
]
,
},
// karma-ng-html2js-preprocessor plugin config.
ngHtml2JsPreprocessor
:
{
stripPrefix
:
conf
.
paths
.
frontendSrc
+
'
/
'
,
moduleName
:
conf
.
frontend
.
moduleName
}
moduleName
:
conf
.
frontend
.
moduleName
,
}
,
};
// Convert all JS code written ES6 with modules to ES5 bundles that browsers can digest.
...
...
build/protractor.conf.js
浏览文件 @
c1f748f3
...
...
@@ -29,10 +29,10 @@ var path = require('path');
*/
exports
.
config
=
{
capabilities
:
{
'
browserName
'
:
'
chrome
'
'
browserName
'
:
'
chrome
'
,
},
baseUrl
:
'
http://localhost:3000
'
,
specs
:
[
path
.
join
(
conf
.
paths
.
integrationTest
,
'
**/*.js
'
)]
specs
:
[
path
.
join
(
conf
.
paths
.
integrationTest
,
'
**/*.js
'
)]
,
};
build/script.js
浏览文件 @
c1f748f3
...
...
@@ -18,6 +18,7 @@
import
gulp
from
'
gulp
'
;
import
gulpAngularTemplatecache
from
'
gulp-angular-templatecache
'
;
import
gulpClosureCompiler
from
'
gulp-closure-compiler
'
;
import
gulpEslint
from
'
gulp-eslint
'
;
import
gulpMinifyHtml
from
'
gulp-minify-html
'
;
import
lodash
from
'
lodash
'
;
import
path
from
'
path
'
;
...
...
@@ -38,11 +39,11 @@ const closureCompilerBaseConfig = {
js_module_root
:
conf
.
paths
.
frontendSrc
,
language_in
:
'
ECMASCRIPT6_STRICT
'
,
language_out
:
'
ECMASCRIPT3
'
,
manage_closure_dependencies
:
true
manage_closure_dependencies
:
true
,
},
compilerPath
:
path
.
join
(
conf
.
paths
.
nodeModules
,
'
google-closure-compiler/compiler.jar
'
),
// This makes the compiler faster. Requires Java 7+.
tieredCompilation
:
true
tieredCompilation
:
true
,
};
...
...
@@ -66,8 +67,8 @@ gulp.task('scripts', ['create-serve-folders'], function() {
// Make source map URLs relative to frontend source directory.
source_map_location_mapping
:
path
.
relative
(
conf
.
paths
.
base
,
conf
.
paths
.
frontendSrc
)
+
'
|
'
,
// Include source map in the output bundle.
output_wrapper
:
'
%output%
\n
//# sourceMappingURL=
'
+
`
${
bundleBaseName
}
.js.map`
}
output_wrapper
:
'
%output%
\n
//# sourceMappingURL=
'
+
`
${
bundleBaseName
}
.js.map`
,
}
,
},
closureCompilerBaseConfig
);
return
gulp
.
src
(
path
.
join
(
conf
.
paths
.
frontendSrc
,
'
**/*.js
'
))
...
...
@@ -81,8 +82,6 @@ gulp.task('scripts', ['create-serve-folders'], function() {
* directory.
*/
gulp
.
task
(
'
scripts:prod
'
,
[
'
angular-templates
'
],
function
()
{
let
bundleBaseName
=
'
app
'
;
let
closureCompilerConfig
=
lodash
.
merge
({
fileName
:
'
app.js
'
,
compilerFlags
:
{
...
...
@@ -103,10 +102,10 @@ gulp.task('scripts', ['create-serve-folders'], function() {
// This check does not work correctly with ES6.
'
inferredConstCheck
'
,
// Let ESLint handle all lint checks.
'
lintChecks
'
'
lintChecks
'
,
],
use_types_for_optimization
:
null
}
use_types_for_optimization
:
null
,
}
,
},
closureCompilerBaseConfig
);
return
gulp
.
src
([
...
...
@@ -116,7 +115,7 @@ gulp.task('scripts', ['create-serve-folders'], function() {
path
.
join
(
conf
.
paths
.
partials
,
'
**/*.js
'
),
// Include base.js to enable some compiler functions, e.g., @export annotation handling.
path
.
join
(
conf
.
paths
.
bowerComponents
,
'
google-closure-library/closure/goog/base.js
'
)
'
google-closure-library/closure/goog/base.js
'
)
,
])
.
pipe
(
gulpClosureCompiler
(
closureCompilerConfig
))
.
pipe
(
gulp
.
dest
(
conf
.
paths
.
prodTmp
));
...
...
@@ -131,10 +130,10 @@ gulp.task('angular-templates', function () {
.
pipe
(
gulpMinifyHtml
({
empty
:
true
,
spare
:
true
,
quotes
:
true
quotes
:
true
,
}))
.
pipe
(
gulpAngularTemplatecache
(
'
angular-templates.js
'
,
{
module
:
conf
.
frontend
.
rootModuleName
module
:
conf
.
frontend
.
rootModuleName
,
}))
.
pipe
(
gulp
.
dest
(
conf
.
paths
.
partials
));
});
...
...
build/serve.js
浏览文件 @
c1f748f3
...
...
@@ -31,15 +31,15 @@ import conf from './conf';
function
browserSyncInit
(
baseDir
)
{
// Enable custom support for Angular apps, e.g., history management.
browserSync
.
use
(
browserSyncSpa
({
selector
:
'
[ng-app]
'
selector
:
'
[ng-app]
'
,
}));
browserSync
.
instance
=
browserSync
.
init
({
startPath
:
'
/
'
,
server
:
{
baseDir
:
baseDir
baseDir
:
baseDir
,
},
browser
:
[]
// Needed so that the browser does not auto-launch.
browser
:
[]
,
// Needed so that the browser does not auto-launch.
});
}
...
...
@@ -52,7 +52,7 @@ gulp.task('serve', ['watch'], function () {
conf
.
paths
.
serve
,
conf
.
paths
.
frontendSrc
,
// For angular templates to work.
conf
.
paths
.
app
,
// For assets to work.
conf
.
paths
.
base
// For bower dependencies to work.
conf
.
paths
.
base
,
// For bower dependencies to work.
]);
});
...
...
@@ -72,7 +72,7 @@ gulp.task('watch', ['index'], function () {
gulp
.
watch
([
path
.
join
(
conf
.
paths
.
frontendSrc
,
'
index.html
'
),
'
bower.json
'
],
[
'
index
'
]);
gulp
.
watch
([
path
.
join
(
conf
.
paths
.
frontendSrc
,
'
**/*.scss
'
)
path
.
join
(
conf
.
paths
.
frontendSrc
,
'
**/*.scss
'
)
,
],
function
(
event
)
{
if
(
event
.
type
===
'
changed
'
)
{
// If this is a file change, rebuild only styles - nothing more is needed.
...
...
build/style.js
浏览文件 @
c1f748f3
...
...
@@ -34,15 +34,15 @@ import conf from './conf';
*/
gulp
.
task
(
'
styles
'
,
function
()
{
let
sassOptions
=
{
style
:
'
expanded
'
style
:
'
expanded
'
,
};
let
cssFilter
=
gulpFilter
(
'
**/*.css
'
,
{
restore
:
true
});
let
cssFilter
=
gulpFilter
(
'
**/*.css
'
,
{
restore
:
true
});
return
gulp
.
src
(
path
.
join
(
conf
.
paths
.
frontendSrc
,
'
**/*.scss
'
))
.
pipe
(
gulpSass
(
sassOptions
))
.
pipe
(
cssFilter
)
.
pipe
(
gulpSourcemaps
.
init
({
loadMaps
:
true
}))
.
pipe
(
gulpSourcemaps
.
init
({
loadMaps
:
true
}))
.
pipe
(
gulpAutoprefixer
())
.
pipe
(
gulpSourcemaps
.
write
())
.
pipe
(
cssFilter
.
restore
)
...
...
@@ -58,7 +58,7 @@ gulp.task('styles', function () {
*/
gulp
.
task
(
'
styles:prod
'
,
function
()
{
let
sassOptions
=
{
style
:
'
compressed
'
style
:
'
compressed
'
,
};
return
gulp
.
src
(
path
.
join
(
conf
.
paths
.
frontendSrc
,
'
**/*.scss
'
))
...
...
build/test.js
浏览文件 @
c1f748f3
...
...
@@ -32,7 +32,7 @@ function runUnitTests(singleRun, doneFn) {
let
localConfig
=
{
configFile
:
conf
.
paths
.
karmaConf
,
singleRun
:
singleRun
,
autoWatch
:
!
singleRun
autoWatch
:
!
singleRun
,
};
let
server
=
new
karma
.
Server
(
localConfig
,
function
(
failCount
)
{
...
...
@@ -48,7 +48,7 @@ function runUnitTests(singleRun, doneFn) {
function
runProtractorTests
(
doneFn
)
{
gulp
.
src
(
path
.
join
(
conf
.
paths
.
integrationTest
,
'
**/*.js
'
))
.
pipe
(
gulpProtractor
.
protractor
({
configFile
:
conf
.
paths
.
protractorConf
configFile
:
conf
.
paths
.
protractorConf
,
}))
.
on
(
'
error
'
,
function
(
err
)
{
doneFn
(
err
);
...
...
src/app/frontend/.eslintrc
浏览文件 @
c1f748f3
...
...
@@ -3,6 +3,12 @@
"plugins": ["angular"],
"rules": {
// Disable undefined variable checking. This is done by the compiler.
"no-undef": 0
"no-undef": 0,
// Disable module getter rule. It gives no benefits in this codebase. Every file is
// in its own module, so there is no variable leaking.
"angular/module-getter": 0,
// Disable dependency injection linting because the linter does not understand
// @ngInject JsDoc annotation.
"angular/di": 0,
}
}
src/app/frontend/index.module.js
浏览文件 @
c1f748f3
...
...
@@ -16,10 +16,10 @@
* @fileoverview Entry point module to the application. Loads and configures other modules needed
* to bootstrap the application.
*/
import
{
config
}
from
'
./index.config
'
;
import
{
RouterController
,
routerConfig
}
from
'
./index.route
'
;
import
{
runBlock
}
from
'
./index.run
'
;
import
{
MainController
}
from
'
./main/main.controller
'
;
import
{
config
}
from
'
./index.config
'
;
import
{
RouterController
,
routerConfig
}
from
'
./index.route
'
;
import
{
runBlock
}
from
'
./index.run
'
;
import
{
MainController
}
from
'
./main/main.controller
'
;
export
default
angular
.
module
(
'
kubernetesConsole
'
,
...
...
src/app/frontend/index.route.js
浏览文件 @
c1f748f3
...
...
@@ -31,7 +31,7 @@ export class RouterController {
*/
constructor
(
$router
)
{
$router
.
config
([
{
path
:
'
/
'
,
component
:
'
main
'
}
{
path
:
'
/
'
,
component
:
'
main
'
},
]);
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录