ソースを参照

Merge pull request #4391 from wenzhixin/feature/stylelint

Added stylelint
Dustin Utecht 6 年 前
コミット
029f88d1c3
5 ファイル変更151 行追加143 行削除
  1. 3 0
      .stylelintrc
  2. 24 16
      .travis.yml
  3. 15 4
      package.json
  4. 109 108
      src/themes/theme.scss
  5. 0 15
      tools/package.json

+ 3 - 0
.stylelintrc

@@ -0,0 +1,3 @@
+{
+  'extends': 'stylelint-config-standard'
+}

+ 24 - 16
.travis.yml

@@ -1,18 +1,26 @@
-language: ruby
-rvm:
-  - 2.4.1
+stages:
+  - test
+  - deploy
 
-script: bash ./deploy.sh
+jobs:
+  include:
+    - stage: test
+      language: node_js
+      node_js:
+        - 10
+      name: "Lint src and check docs"
+      script: npm run pre-commit
+      if: type = pull_request
 
-branches:
-  only:
-  - master
-
-env:
-  global:
-  - ENCRYPTION_LABEL: "5453d0fdf68a"
-  - COMMIT_AUTHOR_EMAIL: "wenzhixin2010@gmail.com"
-
-sudo: false
-
-cache: bundler
+    - stage: deploy
+      name: "Deploy docs"
+      language: ruby
+      rvm:
+        - 2.4.1
+      script: ./deploy.sh
+      if: branch = master AND type = push
+      env:
+        global:
+        - ENCRYPTION_LABEL: "5453d0fdf68a"
+        - COMMIT_AUTHOR_EMAIL: "wenzhixin2010@gmail.com"
+      cache: bundler

+ 15 - 4
package.json

@@ -24,10 +24,22 @@
     "rollup-plugin-node-resolve": "^4.0.1",
     "rollup-plugin-vue": "^5.0.0",
     "sass": "^1.16.1",
-    "vue-template-compiler": "^2.6.10"
+    "stylelint": "^10.1.0",
+    "stylelint-config-standard": "^18.3.0",
+    "vue-template-compiler": "^2.6.10",
+    "chalk": "^2.4.2",
+    "esm": "^3.2.25",
+    "safe-eval": "^0.4.1"
   },
   "scripts": {
-    "lint": "eslint src",
+    "lint:js": "eslint src",
+    "lint:css": "stylelint src/**/*.scss",
+    "lint": "run-s lint:*",
+    "docs:check:api": "cd tools && node check-api.js",
+    "docs:check:locale": "cd tools && node check-locale.js",
+    "docs:check": "run-s docs:check:*",
+    "docs:serve": "bundle exec jekyll serve",
+    "docs": "bundle exec jekyll build",
     "js:build:base": "rollup -c",
     "js:build:min": "NODE_ENV=production rollup -c",
     "js:build:banner": "find dist -name '*.min.js' -exec headr {} -o {} --version --homepage --author --license \\;",
@@ -39,8 +51,7 @@
     "css:build": "run-s css:build:*",
     "clean": "rm -rf dist",
     "build": "run-s lint clean *:build",
-    "docs": "bundle exec jekyll build",
-    "docs-serve": "bundle exec jekyll serve"
+    "pre-commit": "run-s lint docs:check"
   },
   "peerDependencies": {
     "jquery": "1.9.1 - 3"

+ 109 - 108
src/themes/theme.scss

@@ -1,6 +1,6 @@
 .bootstrap-table {
   .fixed-table-toolbar {
-    &:after {
+    &::after {
       content: "";
       display: block;
       clear: both;
@@ -19,6 +19,10 @@
         display: inline-block;
         margin-left: -1px !important;
 
+        > .btn {
+          border-radius: 0;
+        }
+
         &:first-child > .btn {
           border-top-left-radius: 4px;
           border-bottom-left-radius: 4px;
@@ -28,10 +32,6 @@
           border-top-right-radius: 4px;
           border-bottom-right-radius: 4px;
         }
-
-        > .btn {
-          border-radius: 0;
-        }
       }
 
       .dropdown-menu {
@@ -54,6 +54,7 @@
     .columns-left {
       margin-right: 5px;
     }
+
     .columns-right {
       margin-left: 5px;
     }
@@ -68,6 +69,92 @@
     position: relative;
     clear: both;
 
+    .table {
+      width: 100%;
+      margin-bottom: 0 !important;
+
+      th,
+      td {
+        vertical-align: middle;
+        box-sizing: border-box;
+      }
+
+      thead th {
+        vertical-align: bottom;
+        padding: 0;
+        margin: 0;
+
+        &:focus {
+          outline: 0 solid transparent;
+        }
+
+        &.detail {
+          width: 30px;
+        }
+
+        .th-inner {
+          padding: 0.75rem;
+          vertical-align: bottom;
+          overflow: hidden;
+          text-overflow: ellipsis;
+          white-space: nowrap;
+        }
+
+        .sortable {
+          cursor: pointer;
+          background-position: right;
+          background-repeat: no-repeat;
+          padding-right: 30px;
+        }
+
+        .both {
+          background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABMAAAATCAQAAADYWf5HAAAAkElEQVQoz7X QMQ5AQBCF4dWQSJxC5wwax1Cq1e7BAdxD5SL+Tq/QCM1oNiJidwox0355mXnG/DrEtIQ6azioNZQxI0ykPhTQIwhCR+BmBYtlK7kLJYwWCcJA9M4qdrZrd8pPjZWPtOqdRQy320YSV17OatFC4euts6z39GYMKRPCTKY9UnPQ6P+GtMRfGtPnBCiqhAeJPmkqAAAAAElFTkSuQmCC');
+        }
+
+        .asc {
+          background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABMAAAATCAYAAAByUDbMAAAAZ0lEQVQ4y2NgGLKgquEuFxBPAGI2ahhWCsS/gDibUoO0gPgxEP8H4ttArEyuQYxAPBdqEAxPBImTY5gjEL9DM+wTENuQahAvEO9DMwiGdwAxOymGJQLxTyD+jgWDxCMZRsEoGAVoAADeemwtPcZI2wAAAABJRU5ErkJggg==');
+        }
+
+        .desc {
+          background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABMAAAATCAYAAAByUDbMAAAAZUlEQVQ4y2NgGAWjYBSggaqGu5FA/BOIv2PBIPFEUgxjB+IdQPwfC94HxLykus4GiD+hGfQOiB3J8SojEE9EM2wuSJzcsFMG4ttQgx4DsRalkZENxL+AuJQaMcsGxBOAmGvopk8AVz1sLZgg0bsAAAAASUVORK5CYII= ');
+        }
+      }
+
+      tbody tr {
+        &.selected td {
+          background-color: $hover-bg;
+        }
+
+        &.no-records-found {
+          text-align: center;
+        }
+
+        .card-view {
+          display: flex;
+
+          .card-view-title {
+            font-weight: bold;
+            display: inline-block;
+            min-width: 30%;
+            text-align: left !important;
+          }
+        }
+      }
+
+      .bs-checkbox {
+        text-align: center;
+      }
+
+      input[type="radio"],
+      input[type="checkbox"] {
+        margin: 0 auto !important;
+      }
+
+      &.table-sm .th-inner {
+        padding: 0.3rem;
+      }
+    }
+
     &.fixed-height {
       &:not(.has-footer) {
         border-bottom: 1px solid $border-color;
@@ -132,8 +219,8 @@
           }
 
           .animation-dot,
-          .animation-wrap:after,
-          .animation-wrap:before {
+          .animation-wrap::after,
+          .animation-wrap::before {
             content: "";
             animation-duration: 1.5s;
             animation-iteration-count: infinite;
@@ -148,11 +235,11 @@
           }
 
           .animation-dot {
-            animation-delay: .3s;
+            animation-delay: 0.3s;
           }
 
-          .animation-wrap:after{
-            animation-delay:.6s;
+          .animation-wrap::after {
+            animation-delay: 0.6s;
           }
         }
 
@@ -160,107 +247,21 @@
           background: $color;
 
           .animation-dot,
-          .animation-wrap:after,
-          .animation-wrap:before {
+          .animation-wrap::after,
+          .animation-wrap::before {
             background: $background;
           }
         }
       }
     }
 
-    .table {
-      width: 100%;
-      margin-bottom: 0 !important;
-
-      th,
-      td {
-        vertical-align: middle;
-        box-sizing: border-box;
-      }
-
-      thead th {
-        vertical-align: bottom;
-        padding: 0;
-        margin: 0;
-
-        &:focus {
-          outline: 0 solid transparent;
-        }
-
-        &.detail {
-          width: 30px;
-        }
-
-        .th-inner {
-          padding: .75rem;
-          vertical-align: bottom;
-          overflow: hidden;
-          text-overflow: ellipsis;
-          white-space: nowrap;
-        }
-
-        .sortable {
-          cursor: pointer;
-          background-position: right;
-          background-repeat: no-repeat;
-          padding-right: 30px;
-        }
-
-        .both {
-          background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABMAAAATCAQAAADYWf5HAAAAkElEQVQoz7X QMQ5AQBCF4dWQSJxC5wwax1Cq1e7BAdxD5SL+Tq/QCM1oNiJidwox0355mXnG/DrEtIQ6azioNZQxI0ykPhTQIwhCR+BmBYtlK7kLJYwWCcJA9M4qdrZrd8pPjZWPtOqdRQy320YSV17OatFC4euts6z39GYMKRPCTKY9UnPQ6P+GtMRfGtPnBCiqhAeJPmkqAAAAAElFTkSuQmCC');
-        }
-
-        .asc {
-          background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABMAAAATCAYAAAByUDbMAAAAZ0lEQVQ4y2NgGLKgquEuFxBPAGI2ahhWCsS/gDibUoO0gPgxEP8H4ttArEyuQYxAPBdqEAxPBImTY5gjEL9DM+wTENuQahAvEO9DMwiGdwAxOymGJQLxTyD+jgWDxCMZRsEoGAVoAADeemwtPcZI2wAAAABJRU5ErkJggg==');
-        }
-
-        .desc {
-          background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABMAAAATCAYAAAByUDbMAAAAZUlEQVQ4y2NgGAWjYBSggaqGu5FA/BOIv2PBIPFEUgxjB+IdQPwfC94HxLykus4GiD+hGfQOiB3J8SojEE9EM2wuSJzcsFMG4ttQgx4DsRalkZENxL+AuJQaMcsGxBOAmGvopk8AVz1sLZgg0bsAAAAASUVORK5CYII= ');
-        }
-      }
-
-      tbody tr {
-        &.selected td {
-          background-color: $hover-bg;
-        }
-
-        &.no-records-found {
-          text-align: center;
-        }
-
-        .card-view {
-          display: flex;
-
-          .card-view-title {
-            font-weight: bold;
-            display: inline-block;
-            min-width: 30%;
-            text-align: left !important;
-          }
-        }
-      }
-
-      .bs-checkbox {
-        text-align: center;
-      }
-
-      input[type="radio"],
-      input[type="checkbox"] {
-        margin: 0 auto !important;
-      }
-
-      &.table-sm .th-inner {
-        padding: .3rem;
-      }
-    }
-
     .fixed-table-footer {
       overflow: hidden;
     }
   }
 
   .fixed-table-pagination {
-    &:after {
+    &::after {
       content: "";
       display: block;
       clear: both;
@@ -304,15 +305,15 @@
 
         li.page-intermediate {
           a {
-            &:before {
+            &::before {
               content: '\2B05';
             }
 
-            &:after {
+            &::after {
               content: '\27A1';
             }
 
-            color:#c8c8c8;
+            color: #c8c8c8;
           }
         }
 
@@ -329,8 +330,8 @@
     top: 0;
     left: 0;
     z-index: 1050;
-    width: 100%!important;
-    background: #FFF;
+    width: 100% !important;
+    background: #fff;
   }
 }
 
@@ -349,8 +350,8 @@ div.fixed-table-scroll-outer {
   overflow: hidden;
 }
 
-@keyframes LOADING{
-  0% { opacity:0; }
-  50% { opacity:1; }
-  to { opacity:0; }
+@keyframes LOADING {
+  0% { opacity: 0; }
+  50% { opacity: 1; }
+  to { opacity: 0; }
 }

+ 0 - 15
tools/package.json

@@ -1,15 +0,0 @@
-{
-  "name": "tools",
-  "version": "1.0.0",
-  "main": "index.js",
-  "license": "MIT",
-  "dependencies": {
-    "chalk": "^2.4.2",
-    "esm": "^3.2.25",
-    "safe-eval": "^0.4.1"
-  },
-  "scripts": {
-    "check-api": "node check-api",
-    "check-locale": "node check-locale"
-  }
-}