From 41794865a89347ea4b886b4d3894e70ad1b0db6a Mon Sep 17 00:00:00 2001 From: NullVoxPopuli Date: Sun, 12 Jun 2022 13:24:44 -0400 Subject: [PATCH] Sync lint configs --- test-app/.eslintrc.js | 57 +++++------------------------- test-app/tests/test-helper.js | 7 ++-- test-app/types/global.d.ts | 2 +- test-app/types/test-app/index.d.ts | 2 +- 4 files changed, 15 insertions(+), 53 deletions(-) diff --git a/test-app/.eslintrc.js b/test-app/.eslintrc.js index 8a8a4ee..5aad94e 100644 --- a/test-app/.eslintrc.js +++ b/test-app/.eslintrc.js @@ -1,58 +1,19 @@ 'use strict'; +const { configs } = require('@nullvoxpopuli/eslint-configs'); + +// accommodates: JS, TS, App, and Addon +const config = configs.ember(); + module.exports = { - root: true, - parser: 'babel-eslint', - parserOptions: { - ecmaVersion: 2018, - sourceType: 'module', - ecmaFeatures: { - legacyDecorators: true, - }, - }, - plugins: ['ember'], - extends: [ - 'eslint:recommended', - 'plugin:ember/recommended', - 'plugin:prettier/recommended', - ], - env: { - browser: true, - }, - rules: {}, + ...config, overrides: [ - // node files + ...config.overrides, { - files: [ - './.eslintrc.js', - './.prettierrc.js', - './.template-lintrc.js', - './ember-cli-build.js', - './testem.js', - './blueprints/*/index.js', - './config/**/*.js', - './lib/*/index.js', - './server/**/*.js', - ], - parserOptions: { - sourceType: 'script', - }, - env: { - browser: false, - node: true, - }, - plugins: ['node'], - extends: ['plugin:node/recommended'], + files: ['**/*.js', '**/*.ts'], rules: { - // this can be removed once the following is fixed - // https://github.com/mysticatea/eslint-plugin-node/issues/77 - 'node/no-unpublished-require': 'off', + 'prettier/prettier': ['error', require('./.prettierrc')], }, }, - { - // test files - files: ['tests/**/*-test.{js,ts}'], - extends: ['plugin:qunit/recommended'], - }, ], }; diff --git a/test-app/tests/test-helper.js b/test-app/tests/test-helper.js index 8184304..5990eca 100644 --- a/test-app/tests/test-helper.js +++ b/test-app/tests/test-helper.js @@ -1,10 +1,11 @@ -import Application from 'test-app/app'; -import config from 'test-app/config/environment'; -import * as QUnit from 'qunit'; import { setApplication } from '@ember/test-helpers'; +import * as QUnit from 'qunit'; import { setup } from 'qunit-dom'; import { start } from 'ember-qunit'; +import Application from 'test-app/app'; +import config from 'test-app/config/environment'; + setApplication(Application.create(config.APP)); setup(QUnit.assert); diff --git a/test-app/types/global.d.ts b/test-app/types/global.d.ts index 7db39a3..a2addbe 100644 --- a/test-app/types/global.d.ts +++ b/test-app/types/global.d.ts @@ -1,6 +1,6 @@ // Types for compiled templates declare module 'test-app/templates/*' { - import { TemplateFactory } from 'htmlbars-inline-precompile'; + import type { TemplateFactory } from 'htmlbars-inline-precompile'; const tmpl: TemplateFactory; export default tmpl; } diff --git a/test-app/types/test-app/index.d.ts b/test-app/types/test-app/index.d.ts index d2f5fc1..ea7816e 100644 --- a/test-app/types/test-app/index.d.ts +++ b/test-app/types/test-app/index.d.ts @@ -1,4 +1,4 @@ -import Ember from 'ember'; +import type Ember from 'ember'; declare global { // Prevents ESLint from "fixing" this via its auto-fix to turn it into a type