Skip to content

Commit

Permalink
clean up linter setup
Browse files Browse the repository at this point in the history
  • Loading branch information
ef4 committed Dec 16, 2020
1 parent 9d575cc commit 1cf3e74
Show file tree
Hide file tree
Showing 11 changed files with 506 additions and 85 deletions.
3 changes: 0 additions & 3 deletions packages/ember-auto-import/.eslintignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
/dist
/tmp
/test-apps/*/dist
/test-apps/*/tmp
/test-apps/*/node_modules
/js

23 changes: 17 additions & 6 deletions packages/ember-auto-import/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,31 @@
module.exports = {
root: true,
parser: 'babel-eslint',
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 2017,
sourceType: 'module'
},
plugins: [
'ember'
'ember',
'@typescript-eslint',
],
extends: [
'eslint:recommended',
'plugin:ember/recommended'
'plugin:ember/recommended',
'plugin:@typescript-eslint/recommended',
],
env: {
browser: true
},
rules: {
'no-var': 'error'
'no-var': 'error',
'prefer-const': 'off',
'no-fallthrough': 'off', // this doesn't understand typescript's `never`
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/ban-ts-comment': 'off',
},
overrides: [
// node files
Expand All @@ -29,7 +38,8 @@ module.exports = {
'tests/dummy/config/**/*.js',
'lib/**/*.js',
'fastboot-tests/**/*.js',
'babel-plugin/**.js'
'babel-plugin/**.js',
'.eslintrc.js',
],
excludedFiles: [
'addon/**',
Expand All @@ -48,7 +58,8 @@ module.exports = {
plugins: ['node'],
rules: Object.assign({}, require('eslint-plugin-node').configs.recommended.rules, {
// add your custom rules and overrides for node files here
'no-var': 'error'
'no-var': 'error',
'@typescript-eslint/no-var-requires': 'off',
})
}
]
Expand Down
6 changes: 4 additions & 2 deletions packages/ember-auto-import/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"compile": "tsc",
"clean": "git clean -x -f",
"build": "ember build",
"lint": "eslint . && tslint --project .",
"lint": "eslint .",
"start": "ember serve",
"test": "ember test --test-port=0",
"test:node": "qunit js/tests",
Expand Down Expand Up @@ -75,6 +75,8 @@
"@types/resolve": "^0.0.8",
"@types/semver": "^7.3.4",
"@types/webpack": "^4.4.20",
"@typescript-eslint/eslint-plugin": "^4.10.0",
"@typescript-eslint/parser": "^4.10.0",
"babel-eslint": "^8.2.5",
"broccoli": "^3.2.0",
"broccoli-asset-rev": "^2.4.5",
Expand All @@ -99,6 +101,7 @@
"ember-source": "~3.1.0",
"ember-source-channel-url": "^1.0.1",
"ember-try": "^1.2.1",
"eslint": "^7.15.0",
"eslint-plugin-ember": "^5.0.0",
"eslint-plugin-node": "^6.0.1",
"fastboot": "^1.2.0",
Expand All @@ -110,7 +113,6 @@
"quick-temp": "^0.1.8",
"qunit": "^2.6.1",
"qunit-assertions-extra": "^0.8.5",
"tslint": "^5.10.0",
"typescript": "^4.1.2"
},
"engines": {
Expand Down
2 changes: 1 addition & 1 deletion packages/ember-auto-import/ts/auto-import.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ export default class AutoImport implements AutoImportSharedAPI {
if (!host.options.fingerprint) {
host.options.fingerprint = {};
}
if (!host.options.fingerprint.hasOwnProperty('exclude')) {
if (!('exclude' in host.options.fingerprint)) {
host.options.fingerprint.exclude = [pattern];
} else {
host.options.fingerprint.exclude.push(pattern);
Expand Down
4 changes: 2 additions & 2 deletions packages/ember-auto-import/ts/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ module.exports = {
});
},

included() {
included(...args: unknown[]) {
let autoImport = AutoImport.lookup(this);
this._super.included.apply(this, arguments);
this._super.included.apply(this, ...args);
if (autoImport.isPrimary(this)) {
autoImport.included(this);
}
Expand Down
1 change: 1 addition & 0 deletions packages/ember-auto-import/ts/package.ts
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,7 @@ const isAddonCache = new Map<string, boolean>();
function isEmberAddonDependency(pathToPackageJSON: string): boolean {
let cached = isAddonCache.get(pathToPackageJSON);
if (cached === undefined) {
// eslint-disable-next-line @typescript-eslint/no-var-requires
let packageJSON = require(pathToPackageJSON);
let answer = packageJSON.keywords?.includes('ember-addon') || false;
isAddonCache.set(pathToPackageJSON, answer);
Expand Down
1 change: 1 addition & 0 deletions packages/ember-auto-import/ts/splitter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ export default class Splitter {
let pkgPath = findUpPackagePath(dirname(entrypoint));
let version = null;
if (pkgPath) {
// eslint-disable-next-line @typescript-eslint/no-var-requires
let pkg = require(pkgPath);
version = pkg.version;
}
Expand Down
6 changes: 0 additions & 6 deletions packages/ember-auto-import/ts/tests/tslint.json

This file was deleted.

2 changes: 1 addition & 1 deletion packages/ember-auto-import/ts/webpack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ export default class WebpackBundler implements BundlerHook {
}
}

export function mergeConfig(dest: object, ...srcs: object[]) {
export function mergeConfig(dest: Configuration, ...srcs: Configuration[]) {
return mergeWith(dest, ...srcs, combine);
}

Expand Down
24 changes: 0 additions & 24 deletions packages/ember-auto-import/tslint.json

This file was deleted.

Loading

0 comments on commit 1cf3e74

Please sign in to comment.