Browse Source

fix lint errors

Yuki Takei 4 years ago
parent
commit
f656ffdb19

+ 0 - 1
packages/plugin-lsx/src/client/js/components/Lsx.jsx

@@ -27,7 +27,6 @@ export class Lsx extends React.Component {
     };
   }
 
-  // eslint-disable-next-line react/no-deprecated
   componentWillMount() {
     const lsxContext = this.props.lsxContext;
     lsxContext.parse();

+ 1 - 1
packages/plugin-lsx/src/client/js/components/LsxPageList/LsxListView.jsx

@@ -18,7 +18,7 @@ export class LsxListView extends React.Component {
     });
 
     // no contents
-    if (this.props.nodeTree.length == 0) {
+    if (this.props.nodeTree.length === 0) {
       return <div className="text-muted">
         <small>
           <i className="fa fa-fw fa-info-circle" aria-hidden="true"></i>

+ 0 - 1
packages/plugin-lsx/src/client/js/components/LsxPageList/LsxPage.jsx

@@ -22,7 +22,6 @@ export class LsxPage extends React.Component {
     };
   }
 
-  // eslint-disable-next-line react/no-deprecated
   componentWillMount() {
     const pageNode = this.props.pageNode;
 

+ 5 - 2
packages/plugin-lsx/src/client/js/util/LsxContext.js

@@ -31,11 +31,11 @@ export class LsxContext {
         firstArgsValue;
 
       splittedArgs.forEach((arg, index) => {
-        arg = arg.trim();
+        const trimedArg = arg.trim();
 
         // parse string like 'key1=value1, key2=value2, ...'
         // see https://regex101.com/r/pYHcOM/1
-        const match = arg.match(/([^=]+)=?(.+)?/);
+        const match = trimedArg.match(/([^=]+)=?(.+)?/);
         const key = match[1];
         const value = match[2] || true;
         this.options[key] = value;
@@ -71,6 +71,7 @@ export class LsxContext {
   }
 
   getOptDepth() {
+    // eslint-disable-next-line eqeqeq
     if (this.options.depth == undefined) {
       return undefined;
     }
@@ -78,6 +79,7 @@ export class LsxContext {
   }
 
   parseNum(str) {
+    // eslint-disable-next-line eqeqeq
     if (str == undefined) {
       return undefined;
     }
@@ -93,6 +95,7 @@ export class LsxContext {
     let end;
 
     // has operator
+    // eslint-disable-next-line eqeqeq
     if (match[3] != undefined) {
       start = +match[1];
       const operator = match[3];

+ 1 - 6
packages/plugin-lsx/src/server/routes/lsx.js

@@ -75,12 +75,7 @@ class Lsx {
    *
    * @memberOf Lsx
    */
-  static addSortCondition(query, pagePath, optionsSort, optionsReverse) {
-    // the default sort key
-    if (optionsSort == null) {
-      optionsSort = 'path';
-    }
-
+  static addSortCondition(query, pagePath, optionsSort = 'path', optionsReverse) {
     // the default sort order
     let isReversed = false;