You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@annotator.apache.org by ra...@apache.org on 2019/05/23 15:29:49 UTC

[incubator-annotator] 03/05: Convert ESLint config to JavaScript

This is an automated email from the ASF dual-hosted git repository.

randall pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-annotator.git

commit 828a182d3fb6d068331e99c27ba0f4cf13508678
Author: Randall Leeds <ra...@apache.org>
AuthorDate: Thu May 23 10:42:53 2019 -0400

    Convert ESLint config to JavaScript
    
    Writing the configuration in JavaScript is more approachable for
    JavaScript developers than YAML and allows using the Node.js runtime if
    careful relative path resolution is necessary for correct configuration.
---
 .eslintignore |  1 +
 .eslintrc.js  | 76 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 .eslintrc.yml | 71 -------------------------------------------------------
 3 files changed, 77 insertions(+), 71 deletions(-)

diff --git a/.eslintignore b/.eslintignore
index 8b9639d..49e918e 100644
--- a/.eslintignore
+++ b/.eslintignore
@@ -1,3 +1,4 @@
+!.eslintrc.js
 /coverage
 /packages/*/esm/*
 /packages/*/lib/*
diff --git a/.eslintrc.js b/.eslintrc.js
new file mode 100644
index 0000000..2b8a0d7
--- /dev/null
+++ b/.eslintrc.js
@@ -0,0 +1,76 @@
+module.exports = {
+  root: true,
+  env: {
+    es6: true,
+    'shared-node-browser': true,
+  },
+  extends: ['eslint:recommended', 'plugin:import/recommended', 'prettier'],
+  globals: {
+    globalThis: true,
+  },
+  parser: 'babel-eslint',
+  parserOptions: {
+    ecmaVersion: '2018',
+  },
+  plugins: ['import', 'prettier'],
+  rules: {
+    'import/no-default-export': 'error',
+    'import/order': 'error',
+    'import/unambiguous': 'error',
+    'no-restricted-syntax': [
+      'error',
+      'BindExpression',
+      'ClassProperty',
+      'Decorator',
+      'DoExpression',
+      'ExportDefaultSpecifier',
+      'ExportNamespaceSpecifier',
+      'TypeAnnotation',
+      'JSXElement',
+    ],
+    'prettier/prettier': [
+      'error',
+      {
+        singleQuote: true,
+        trailingComma: 'es5',
+      },
+    ],
+  },
+  settings: {
+    'import/resolver': {
+      'babel-module': {},
+    },
+  },
+  overrides: [
+    {
+      files: ['.eslintrc.js', '.mocharc.js', 'babel.config.js', 'scripts/*.js'],
+      env: {
+        node: true,
+      },
+      parser: 'espree',
+      parserOptions: {
+        sourceType: 'script',
+      },
+      plugins: ['node'],
+      rules: {
+        'no-console': 'off',
+        'node/no-unsupported-features': 'error',
+      },
+    },
+    {
+      files: ['demo/**/*.js'],
+      env: {
+        browser: true,
+      },
+    },
+    {
+      files: ['packages/*/test/**/*.js', 'test/**/*.js'],
+      env: {
+        mocha: true,
+      },
+      globals: {
+        assert: true,
+      },
+    },
+  ],
+};
diff --git a/.eslintrc.yml b/.eslintrc.yml
deleted file mode 100644
index 795d782..0000000
--- a/.eslintrc.yml
+++ /dev/null
@@ -1,71 +0,0 @@
-root: true
-
-env:
-  es6: true
-  shared-node-browser: true
-
-extends:
-  - eslint:recommended
-  - plugin:import/recommended
-  - prettier
-
-globals:
-  globalThis: true
-
-parser: babel-eslint
-
-parserOptions:
-  ecmaVersion: 2018
-
-plugins:
-  - import
-  - prettier
-
-rules:
-  import/no-default-export: error
-  import/order: error
-  import/unambiguous: error
-  no-restricted-syntax:
-    - error
-    - BindExpression
-    - ClassProperty
-    - Decorator
-    - DoExpression
-    - ExportDefaultSpecifier
-    - ExportNamespaceSpecifier
-    - TypeAnnotation
-    - JSXElement
-  prettier/prettier:
-    - error
-    - singleQuote: true
-      trailingComma: es5
-
-settings:
-  import/resolver: babel-module
-
-overrides:
-  - files:
-      - '.mocharc.js'
-      - 'babel.config.js'
-      - 'scripts/*.js'
-    env:
-      node: true
-    parser: espree
-    parserOptions:
-      sourceType: script
-    plugins:
-      - node
-    rules:
-      no-console: off
-      node/no-unsupported-features: error
-  - files:
-      - 'demo/**/*.js'
-    env:
-      browser: true
-  - files:
-      - 'packages/*/test/**/*.js'
-      - 'test/**/*.js'
-    env:
-      mocha: true
-    globals:
-      assert: true