Skip to content

Commit 102309f

Browse files
Merge pull request #1 from NullVoxPopuli/implementation
Initial Implementation
2 parents f60e9f7 + d46da97 commit 102309f

12 files changed

Lines changed: 777 additions & 198 deletions

File tree

.github/workflows/ci.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
- uses: pnpm/action-setup@v4
2323
- uses: actions/setup-node@v4
2424
with:
25-
node-version: 18
25+
node-version: 22
2626
cache: pnpm
2727
- name: Install Dependencies
2828
run: pnpm install --frozen-lockfile
@@ -41,7 +41,7 @@ jobs:
4141
- uses: pnpm/action-setup@v4
4242
- uses: actions/setup-node@v4
4343
with:
44-
node-version: 18
44+
node-version: 22
4545
cache: pnpm
4646
- name: Install Dependencies
4747
run: pnpm install --frozen-lockfile
@@ -51,7 +51,7 @@ jobs:
5151
- id: set-matrix
5252
run: |
5353
echo "matrix=$(pnpm -s dlx @embroider/try list)" >> $GITHUB_OUTPUT
54-
54+
5555
5656
floating:
5757
name: "Floating Dependencies"
@@ -63,7 +63,7 @@ jobs:
6363
- uses: pnpm/action-setup@v4
6464
- uses: actions/setup-node@v4
6565
with:
66-
node-version: 18
66+
node-version: 22
6767
cache: pnpm
6868
- name: Install Dependencies
6969
run: pnpm install --no-lockfile
@@ -84,16 +84,16 @@ jobs:
8484
- uses: pnpm/action-setup@v4
8585
- uses: actions/setup-node@v4
8686
with:
87-
node-version: 18
87+
node-version: 22
8888
cache: pnpm
8989
- name: Apply Scenario
9090
run: |
9191
pnpm dlx @embroider/try apply ${{ matrix.name }}
92-
92+
9393
- name: Install Dependencies
9494
run: pnpm install --no-lockfile
9595
- name: Run Tests
9696
run: |
9797
pnpm test
98-
98+
9999
env: ${{ matrix.env }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
dist/
33
dist-tests/
44
declarations/
5+
.log/
56

67
# from scenarios
78
tmp/

README.md

Lines changed: 38 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,51 @@
11
# ember-strict-resolver
22

3-
[Short description of the addon.]
4-
5-
## Compatibility
6-
7-
- Ember.js v4.12 or above
8-
- Embroider or ember-auto-import v2
3+
A polyfill implementation of the upcoming default strict resolver built in to Ember.
94

105
## Installation
116

127
```
13-
ember install ember-strict-resolver
8+
npm add ember-strict-resolver
149
```
1510

1611
## Usage
1712

18-
[Longer description of how to use the addon in apps.]
13+
In your app.js or app.ts, or wherever you configure your application
14+
```diff
15+
import config from '<app-name>/config/environment';
16+
- import EmberApp from '@ember/application';
17+
- import EmberResolver from 'ember-resolver';
18+
+ import EmberApp from 'ember-strict-resolver';
19+
20+
class TestApp extends EmberApp {
21+
modulePrefix = config.modulePrefix;
22+
- Resolver = EmberResolver.withModules({
23+
- [`${config.modulePrefix}/router`]: { default: Router },
24+
- [`${config.modulePrefix}/services/manual`]: { default: Manual },
25+
- });
26+
27+
+ modules = {
28+
+ './router': { default: Router },
29+
+ './services/manual': { default: SomeService },
30+
+ './services/manual-shorthand': SomeOtherService,
31+
+
32+
+ // now import.meta.glob just works
33+
+ ...import.meta.glob('./services/**/*', { eager: true }),
34+
+ ...import.meta.glob('./routes/*', { eager: true }),
35+
+ ...import.meta.glob('./templates/**/*', { eager: true }),
36+
+ };
37+
}
38+
```
39+
40+
The type of `modules` is:
41+
```ts
42+
{
43+
[modulePath: string]:
44+
| ExportableType
45+
| { [exportName: string]: ExportableType };
46+
};
47+
```
48+
1949

2050
## Contributing
2151

eslint.config.mjs

Lines changed: 10 additions & 132 deletions
Original file line numberDiff line numberDiff line change
@@ -1,138 +1,16 @@
1-
/**
2-
* Debugging:
3-
* https://eslint.org/docs/latest/use/configure/debug
4-
* ----------------------------------------------------
5-
*
6-
* Print a file's calculated configuration
7-
*
8-
* npx eslint --print-config path/to/file.js
9-
*
10-
* Inspecting the config
11-
*
12-
* npx eslint --inspect-config
13-
*
14-
*/
15-
import babelParser from '@babel/eslint-parser';
16-
import js from '@eslint/js';
17-
import prettier from 'eslint-config-prettier';
18-
import ember from 'eslint-plugin-ember/recommended';
19-
import importPlugin from 'eslint-plugin-import';
20-
import n from 'eslint-plugin-n';
21-
import globals from 'globals';
22-
import ts from 'typescript-eslint';
1+
import { configs } from '@nullvoxpopuli/eslint-configs';
232

24-
const esmParserOptions = {
25-
ecmaFeatures: { modules: true },
26-
ecmaVersion: 'latest',
27-
};
28-
29-
const tsParserOptions = {
30-
projectService: true,
31-
project: true,
32-
tsconfigRootDir: import.meta.dirname,
33-
};
34-
35-
const config = [
36-
js.configs.recommended,
37-
prettier,
38-
ember.configs.base,
39-
ember.configs.gjs,
40-
ember.configs.gts,
41-
/**
42-
* Ignores must be in their own object
43-
* https://eslint.org/docs/latest/use/configure/ignore
44-
*/
45-
{
46-
ignores: [
47-
'dist/',
48-
'dist-*/',
49-
'declarations/',
50-
'node_modules/',
51-
'coverage/',
52-
'!**/.*',
53-
],
54-
},
55-
/**
56-
* https://eslint.org/docs/latest/use/configure/configuration-files#configuring-linter-options
57-
*/
58-
{
59-
linterOptions: {
60-
reportUnusedDisableDirectives: 'error',
61-
},
62-
},
63-
{
64-
files: ['**/*.js'],
65-
languageOptions: {
66-
parser: babelParser,
67-
},
68-
},
69-
{
70-
files: ['**/*.{js,gjs}'],
71-
languageOptions: {
72-
parserOptions: esmParserOptions,
73-
globals: {
74-
...globals.browser,
75-
},
76-
},
77-
},
78-
{
79-
files: ['**/*.{ts,gts}'],
80-
languageOptions: {
81-
parser: ember.parser,
82-
parserOptions: tsParserOptions,
83-
},
84-
extends: [...ts.configs.recommendedTypeChecked, ember.configs.gts],
85-
},
3+
// accommodates: JS, TS, App, Addon, and V2 Addon
4+
export default [
5+
...configs.ember(import.meta.dirname),
866
{
87-
files: ['src/**/*'],
88-
plugins: {
89-
import: importPlugin,
90-
},
7+
files: ['**/*.ts'],
918
rules: {
92-
// require relative imports use full extensions
93-
'import/extensions': ['error', 'always', { ignorePackages: true }],
94-
},
95-
},
96-
/**
97-
* CJS node files
98-
*/
99-
{
100-
files: [
101-
'**/*.cjs',
102-
'.prettierrc.cjs',
103-
'.template-lintrc.cjs',
104-
'addon-main.cjs',
105-
],
106-
plugins: {
107-
n,
108-
},
109-
110-
languageOptions: {
111-
sourceType: 'script',
112-
ecmaVersion: 'latest',
113-
globals: {
114-
...globals.node,
115-
},
116-
},
117-
},
118-
/**
119-
* ESM node files
120-
*/
121-
{
122-
files: ['**/*.mjs'],
123-
plugins: {
124-
n,
125-
},
126-
127-
languageOptions: {
128-
sourceType: 'module',
129-
ecmaVersion: 'latest',
130-
parserOptions: esmParserOptions,
131-
globals: {
132-
...globals.node,
133-
},
9+
'@typescript-eslint/no-explicit-any': 'off',
10+
'@typescript-eslint/unbound-method': 'off',
11+
'@typescript-eslint/no-unsafe-member-access': 'off',
12+
'@typescript-eslint/no-unsafe-assignment': 'off',
13+
'@typescript-eslint/no-unsafe-argument': 'off',
13414
},
13515
},
13616
];
137-
138-
export default ts.config(...config);

package.json

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,24 +34,23 @@
3434
},
3535
"devDependencies": {
3636
"@babel/core": "^7.25.2",
37-
"@babel/eslint-parser": "^7.25.1",
3837
"@babel/plugin-transform-typescript": "^7.25.2",
3938
"@babel/runtime": "^7.25.6",
39+
"@ember/app-tsconfig": "^1.0.0",
40+
"@ember/library-tsconfig": "^1.0.0",
4041
"@ember/test-helpers": "^5.2.1",
4142
"@embroider/addon-dev": "^8.1.0",
42-
"@embroider/core": "^4.1.0",
4343
"@embroider/compat": "^4.1.0",
44+
"@embroider/core": "^4.1.0",
4445
"@embroider/macros": "^1.18.0",
4546
"@embroider/vite": "^1.1.5",
46-
"@eslint/js": "^9.17.0",
4747
"@glimmer/component": "^2.0.0",
4848
"@glint/core": "^2.0.0-alpha.2",
4949
"@glint/environment-ember-loose": "^2.0.0-alpha.2",
5050
"@glint/environment-ember-template-imports": "^2.0.0-alpha.2",
51-
"@glint/tsserver-plugin": "^2.0.0-alpha.2",
5251
"@glint/template": "^1.6.0-alpha.1",
53-
"@ember/app-tsconfig": "^1.0.0",
54-
"@ember/library-tsconfig": "^1.0.0",
52+
"@glint/tsserver-plugin": "^2.0.0-alpha.2",
53+
"@nullvoxpopuli/eslint-configs": "^5.3.0",
5554
"@rollup/plugin-babel": "^6.0.4",
5655
"@types/qunit": "^2.19.12",
5756
"babel-plugin-ember-template-compilation": "^2.2.5",
@@ -61,18 +60,13 @@
6160
"ember-source": "^6.3.0",
6261
"ember-template-lint": "^7.9.0",
6362
"eslint": "^9.17.0",
64-
"eslint-config-prettier": "^10.1.5",
65-
"eslint-plugin-ember": "^12.3.3",
66-
"eslint-plugin-import": "^2.31.0",
67-
"eslint-plugin-n": "^17.15.1",
6863
"globals": "^16.1.0",
6964
"prettier": "^3.4.2",
7065
"prettier-plugin-ember-template-tag": "^2.0.4",
7166
"qunit": "^2.24.1",
7267
"qunit-dom": "^3.4.0",
7368
"rollup": "^4.22.5",
7469
"testem": "^3.15.1",
75-
"typescript-eslint": "^8.19.1",
7670
"typescript": "~5.8.3",
7771
"vite": "^6.2.4"
7872
},
@@ -84,6 +78,7 @@
8478
"type": "addon",
8579
"main": "addon-main.cjs"
8680
},
81+
"packageManager": "[email protected]",
8782
"imports": {
8883
"#src/*": "./src/*"
8984
},

0 commit comments

Comments
 (0)