From 2fc93ac5f7bd3087dad9b21954964c61a61e8935 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guillaume=20G=C3=A9rard?= Date: Mon, 4 Jan 2021 12:09:33 +0100 Subject: [PATCH] refactor: define an ember-core eslint config for ember-app and ember-addon configs --- ember-addon.js | 36 +----------------------------- ember-core.js | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++ ember.js | 35 +---------------------------- 3 files changed, 62 insertions(+), 69 deletions(-) create mode 100644 ember-core.js diff --git a/ember-addon.js b/ember-addon.js index 0ad44c3..bdb5045 100644 --- a/ember-addon.js +++ b/ember-addon.js @@ -1,40 +1,13 @@ module.exports = { - parser: "babel-eslint", - parserOptions: { - ecmaVersion: 2018, - sourceType: "module", - ecmaFeatures: { - legacyDecorators: true - } - }, - plugins: [ - "ember", - "ember-suave" - ], extends: [ - "eslint:recommended", - "plugin:ember/recommended", - "plugin:ember-suave/recommended", - "./core.js" + "./ember-core.js" ], - env: { - browser: true - }, - rules: { - "ember/no-jquery": "warn", - "ember-suave/require-access-in-comments": "off" - }, overrides: [ // node files { files: [ - ".eslintrc.js", - ".template-lintrc.js", - "ember-cli-build.js", "index.js", - "testem.js", "blueprints/*/index.js", - "config/**/*.js", "tests/dummy/config/**/*.js" ], excludedFiles: [ @@ -57,13 +30,6 @@ module.exports = { // https://github.com/mysticatea/eslint-plugin-node/issues/77 'node/no-unpublished-require': 'off' } - }, - // testem config file - { - files: ["testem.js"], - rules: { - camelcase: "off" - } } ] } diff --git a/ember-core.js b/ember-core.js new file mode 100644 index 0000000..91845c2 --- /dev/null +++ b/ember-core.js @@ -0,0 +1,60 @@ +module.exports = { + parser: "babel-eslint", + parserOptions: { + ecmaVersion: 2018, + sourceType: "module", + ecmaFeatures: { + legacyDecorators: true + } + }, + plugins: [ + "ember", + "ember-suave" + ], + extends: [ + "eslint:recommended", + "plugin:ember/recommended", + "plugin:ember-suave/recommended", + "./core.js" + ], + env: { + browser: true + }, + rules: { + "ember/no-jquery": "warn", + "ember-suave/require-access-in-comments": "off" + }, + overrides: [ + // node files + { + files: [ + ".eslintrc.js", + ".template-lintrc.js", + "ember-cli-build.js", + "testem.js", + "config/**/*.js" + ], + parserOptions: { + sourceType: "script" + }, + env: { + browser: false, + node: true + }, + plugins: ["node"], + extends: ['plugin:node/recommended'], + rules: { + // this can be removed once the following is fixed + // https://github.com/mysticatea/eslint-plugin-node/issues/77 + 'node/no-unpublished-require': 'off' + } + }, + // testem config file + { + files: ["testem.js"], + rules: { + camelcase: "off" + } + } + ] +} diff --git a/ember.js b/ember.js index 7d0e1d8..46b5a56 100644 --- a/ember.js +++ b/ember.js @@ -1,37 +1,11 @@ module.exports = { - parser: "babel-eslint", - parserOptions: { - ecmaVersion: 2018, - sourceType: "module", - ecmaFeatures: { - legacyDecorators: true - } - }, - plugins: [ - "ember", - "ember-suave" - ], extends: [ - "eslint:recommended", - "plugin:ember/recommended", - "plugin:ember-suave/recommended", - "./core.js" + "./ember-core.js" ], - env: { - browser: true - }, - rules: { - "ember/no-jquery": "warn", - "ember-suave/require-access-in-comments": "off" - }, overrides: [ // node files { files: [ - ".eslintrc.js", - ".template-lintrc.js", - "ember-cli-build.js", - "testem.js", "config/**/*.js", "lib/*/index.js", "server/**/*.js" @@ -50,13 +24,6 @@ module.exports = { // https://github.com/mysticatea/eslint-plugin-node/issues/77 'node/no-unpublished-require': 'off' } - }, - // testem config file - { - files: ["testem.js"], - rules: { - camelcase: "off" - } } ] }