Procházet zdrojové kódy

chore: enable eslint for entire scripts/*

tophf před 1 rokem
rodič
revize
4c07327447
2 změnil soubory, kde provedl 5 přidání a 9 odebrání
  1. 1 6
      .eslintignore
  2. 4 3
      scripts/i18n.js

+ 1 - 6
.eslintignore

@@ -1,11 +1,6 @@
 **/*.js
 !src/**
 !test/**
-!scripts/action-helper.js
-!scripts/fake-dep-loader.js
-!scripts/manifest-helper.js
-!scripts/webpack.conf.js
-!scripts/webpack-protect-bootstrap-plugin.js
-!scripts/webpack-util.js
+!scripts/*
 !gulpfile.js
 src/public/**

+ 4 - 3
scripts/i18n.js

@@ -56,6 +56,7 @@ class Locale {
     if (extension === '.json') {
       if (stripDescriptions) {
         data = Object.entries(data).reduce((res, [key, value]) => {
+          // eslint-disable-next-line no-unused-vars
           const { description, ...stripped } = value;
           res[key] = stripped;
           return res;
@@ -142,7 +143,7 @@ function extract(options) {
     default: ['\\b(?:i18n\\(\'|i18n-key=")(\\w+)[\'"]', 1],
     json: ['__MSG_(\\w+)__', 1],
   };
-  const types = {
+  const typePatternMap = {
     '.js': 'default',
     '.json': 'json',
     '.html': 'default',
@@ -158,7 +159,7 @@ function extract(options) {
       const pattern = new RegExp(patternData[0], 'g');
       const groupId = patternData[1];
       let groups;
-      while (groups = pattern.exec(data)) {
+      while ((groups = pattern.exec(data))) {
         keys.add(groups[groupId]);
       }
     });
@@ -168,7 +169,7 @@ function extract(options) {
     if (file.isNull()) return cb();
     if (file.isStream()) return this.emit('error', new PluginError('VM-i18n', 'Stream is not supported.'));
     const extname = path.extname(file.path);
-    const type = types[extname];
+    const type = typePatternMap[extname];
     if (type) extractFile(file.contents, type);
     cb();
   }