Skip to content

Commit

Permalink
Update lints
Browse files Browse the repository at this point in the history
  • Loading branch information
NullVoxPopuli committed Nov 15, 2022
1 parent 3b0dd91 commit 870b72f
Show file tree
Hide file tree
Showing 9 changed files with 87 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module.exports = {
sourceType: 'module',
},
plugins: ['import', 'prettier', '@typescript-eslint'],
extends: ['prettier'],
extends: ['prettier', 'n/recommended'],
rules: {
eqeqeq: ['error', 'smart'],
'no-debugger': 'error',
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
"eslint": "^7.14.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-import": "^2.22.0",
"eslint-plugin-n": "^15.5.1",
"eslint-plugin-prettier": "^3.1.4",
"jest": "^29.2.1",
"prettier": "^2.3.1",
Expand Down
26 changes: 24 additions & 2 deletions packages/addon-shim/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ module.exports = {
extends: [
'eslint:recommended',
'plugin:ember/recommended',
'plugin:n/recommended',
'plugin:prettier/recommended',
],
env: {
Expand Down Expand Up @@ -46,8 +47,8 @@ module.exports = {
browser: false,
node: true,
},
plugins: ['node'],
extends: ['plugin:node/recommended'],
plugins: ['n'],
extends: ['plugin:n/recommended'],
},
// node typescript files
{
Expand All @@ -64,6 +65,27 @@ module.exports = {
plugins: ['@typescript-eslint'],
extends: ['prettier'],
rules: {
/**
* This rule requires that certain ES features only be allowed
* if our minimum engines version allows them.
* Since we transpile the code to CJS, this rule isn't meaningful to us.
*/
'n/no-unsupported-features/es-syntax': 'off',
/**
* eslint-plugin-n doesn't understand type imports as *output* is concerned.
* See: https://github.com/eslint-community/eslint-plugin-n/issues/66
*
* There is no way for a plugin to _know_ that an import is removed at build time,
* or ever if there is a build time.
* So we need to disable these two rules.
* The downside is that we don't have a way to know (aside from typescript telling us)
* if a type-only-dependency is missing
*
* We still have n/no-extraneous-import, which is still valuable
*/
'n/no-missing-import': 'off',
'n/no-unpublished-import': 'off',

'@typescript-eslint/naming-convention': [
'error',
{
Expand Down
6 changes: 4 additions & 2 deletions packages/addon-shim/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,14 @@
"devDependencies": {
"@types/semver": "^7.3.6",
"typescript": "*",
"webpack": "^5"
"webpack": "^5",
"eslint-plugin-n": "^15.5.1",
"eslint": "^7.14.0"
},
"engines": {
"node": "12.* || 14.* || >= 16"
},
"volta": {
"extends": "../../package.json"
}
}
}
27 changes: 24 additions & 3 deletions packages/router/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,34 @@ module.exports = {
extends: [
'eslint:recommended',
'plugin:ember/recommended',
'plugin:n/recommended',
'plugin:prettier/recommended',
],
env: {
browser: true,
},
rules: {},
rules: {
/**
* This rule requires that certain ES features only be allowed
* if our minimum engines version allows them.
* Since we transpile the code to CJS, this rule isn't meaningful to us.
*/
'n/no-unsupported-features/es-syntax': 'off',
/**
* eslint-plugin-n doesn't understand type imports as *output* is concerned.
* See: https://github.com/eslint-community/eslint-plugin-n/issues/66
*
* There is no way for a plugin to _know_ that an import is removed at build time,
* or ever if there is a build time.
* So we need to disable these two rules.
* The downside is that we don't have a way to know (aside from typescript telling us)
* if a type-only-dependency is missing
*
* We still have n/no-extraneous-import, which is still valuable
*/
'n/no-missing-import': 'off',
'n/no-unpublished-import': 'off',
},
overrides: [
// node files
{
Expand Down Expand Up @@ -47,8 +69,7 @@ module.exports = {
browser: false,
node: true,
},
plugins: ['node'],
extends: ['plugin:node/recommended'],
extends: ['plugin:n/recommended'],
},
{
// test files
Expand Down
1 change: 1 addition & 0 deletions packages/router/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
"eslint": "^7.32.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-ember": "^11.0.2",
"eslint-plugin-n": "^15.5.1",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-qunit": "^7.3.1",
Expand Down
6 changes: 6 additions & 0 deletions packages/router/tests/dummy/app/app.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
import Application from '@ember/application';
// Disabled because dummy apps are invalid packages
// (and we have a package.json in tests/dummy, which has no deps)
// eslint-disable-next-line n/no-extraneous-import
import Resolver from 'ember-resolver';
// Disabled because dummy apps are invalid packages
// (and we have a package.json in tests/dummy, which has no deps)
// eslint-disable-next-line n/no-extraneous-import
import loadInitializers from 'ember-load-initializers';
import config from 'dummy/config/environment';

Expand Down
2 changes: 2 additions & 0 deletions packages/router/tests/dummy/app/router.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Disabled because dummy apps are invalid packages
// eslint-disable-next-line n/no-extraneous-import
import EmberRouter from '@embroider/router';
import config from 'dummy/config/environment';

Expand Down
26 changes: 24 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5810,7 +5810,7 @@ builtins@^1.0.3:
resolved "https://registry.yarnpkg.com/builtins/-/builtins-1.0.3.tgz#cb94faeb61c8696451db36534e1422f94f0aee88"
integrity sha512-uYBjakWipfaO/bXI7E8rq6kpwHRZK5cNYrUv2OzZSI/FvmdMyXJ2tG9dKcjEC5YHmHpUAwsargWIZNWdxb/bnQ==

builtins@^5.0.0:
builtins@^5.0.0, builtins@^5.0.1:
version "5.0.1"
resolved "https://registry.yarnpkg.com/builtins/-/builtins-5.0.1.tgz#87f6db9ab0458be728564fa81d876d8d74552fa9"
integrity sha512-qwVpFEHNfhYJIzNRBvd2C1kyo6jz3ZSMPyyuR47OPdiKWlbYnZNyDWuyR175qDnAJLiCo5fBBqPb3RiXgWlkOQ==
Expand Down Expand Up @@ -9218,6 +9218,14 @@ eslint-plugin-es@^3.0.0:
eslint-utils "^2.0.0"
regexpp "^3.0.0"

eslint-plugin-es@^4.1.0:
version "4.1.0"
resolved "https://registry.yarnpkg.com/eslint-plugin-es/-/eslint-plugin-es-4.1.0.tgz#f0822f0c18a535a97c3e714e89f88586a7641ec9"
integrity sha512-GILhQTnjYE2WorX5Jyi5i4dz5ALWxBIdQECVQavL6s7cI76IZTDWleTHkxz/QT3kvcs2QlGHvKLYsSlPOlPXnQ==
dependencies:
eslint-utils "^2.0.0"
regexpp "^3.0.0"

eslint-plugin-import@^2.22.0:
version "2.26.0"
resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.26.0.tgz#f812dc47be4f2b72b478a021605a59fc6fe8b88b"
Expand All @@ -9237,6 +9245,20 @@ eslint-plugin-import@^2.22.0:
resolve "^1.22.0"
tsconfig-paths "^3.14.1"

eslint-plugin-n@^15.5.1:
version "15.5.1"
resolved "https://registry.yarnpkg.com/eslint-plugin-n/-/eslint-plugin-n-15.5.1.tgz#b3991857d1edaa47e0108ead825470ce63f391c1"
integrity sha512-kAd+xhZm7brHoFLzKLB7/FGRFJNg/srmv67mqb7tto22rpr4wv/LV6RuXzAfv3jbab7+k1wi42PsIhGviywaaw==
dependencies:
builtins "^5.0.1"
eslint-plugin-es "^4.1.0"
eslint-utils "^3.0.0"
ignore "^5.1.1"
is-core-module "^2.11.0"
minimatch "^3.1.2"
resolve "^1.22.1"
semver "^7.3.8"

eslint-plugin-node@^11.1.0:
version "11.1.0"
resolved "https://registry.yarnpkg.com/eslint-plugin-node/-/eslint-plugin-node-11.1.0.tgz#c95544416ee4ada26740a30474eefc5402dc671d"
Expand Down Expand Up @@ -11391,7 +11413,7 @@ is-ci@^3.0.1:
dependencies:
ci-info "^3.2.0"

is-core-module@^2.8.1, is-core-module@^2.9.0:
is-core-module@^2.11.0, is-core-module@^2.8.1, is-core-module@^2.9.0:
version "2.11.0"
resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.11.0.tgz#ad4cb3e3863e814523c96f3f58d26cc570ff0144"
integrity sha512-RRjxlvLDkD1YJwDbroBHMb+cukurkDWNyHx7D3oNB5x9rb5ogcksMC5wHCadcXoo67gVr/+3GFySh3134zi6rw==
Expand Down

0 comments on commit 870b72f

Please sign in to comment.