Skip to content

Commit

Permalink
chore: use references for tsc, add checks to schema-record, bun to ru…
Browse files Browse the repository at this point in the history
…n scripts (emberjs#9051)

* use references for tsc, add checks to schema-record, bun to run scripts

* fixup lint

* fix lint
  • Loading branch information
runspired authored Oct 24, 2023
1 parent addf467 commit 2ca4a57
Show file tree
Hide file tree
Showing 65 changed files with 408 additions and 179 deletions.
6 changes: 3 additions & 3 deletions packages/-ember-data/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
"lint": "eslint . --quiet --cache --cache-strategy=content --ext .js,.ts,.mjs,.cjs",
"move-dts": "bun ../../scripts/copy-declarations.mjs addon",
"build:types": "tsc --build",
"_build": "pnpm build:types && pnpm move-dts",
"prepack": "pnpm build && cd ../../ && pnpm build:docs",
"_syncPnpm": "pnpm sync-dependencies-meta-injected"
"_build": "bun run build:types && bun run move-dts",
"prepack": "pnpm build && cd ../../ && bun run build:docs",
"_syncPnpm": "bun run sync-dependencies-meta-injected"
},
"files": [
"dist/docs",
Expand Down
13 changes: 13 additions & 0 deletions packages/-ember-data/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,17 @@
"@ember-data/env": ["../private-build-infra/virtual-packages/env.d.ts"],
}
},
"references": [
{ "path": "../adapter" },
{ "path": "../graph" },
{ "path": "../json-api" },
{ "path": "../legacy-compat" },
{ "path": "../model" },
{ "path": "../request" },
{ "path": "../request-utils" },
{ "path": "../serializer" },
{ "path": "../store" },
{ "path": "../tracking" },
{ "path": "../core-types" },
]
}
4 changes: 2 additions & 2 deletions packages/active-record/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@
"lint": "eslint . --quiet --cache --cache-strategy=content --ext .js,.ts,.mjs,.cjs",
"build:types": "tsc --build",
"build:client": "rollup --config && babel ./addon --out-dir addon --plugins=../private-build-infra/src/transforms/babel-plugin-transform-ext.js",
"_build": "pnpm build:client && pnpm build:types",
"_build": "bun run build:client && bun run build:types",
"prepack": "pnpm build",
"_syncPnpm": "pnpm sync-dependencies-meta-injected"
"_syncPnpm": "bun run sync-dependencies-meta-injected"
},
"ember-addon": {
"main": "addon-main.js",
Expand Down
7 changes: 7 additions & 0 deletions packages/active-record/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,11 @@
"@ember-data/env": ["../private-build-infra/virtual-packages/env.d.ts"],
}
},
"references": [
{ "path": "../request" },
{ "path": "../request-utils" },
{ "path": "../store" },
{ "path": "../tracking" },
{ "path": "../core-types" },
]
}
4 changes: 2 additions & 2 deletions packages/adapter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
"lint": "eslint . --quiet --cache --cache-strategy=content --ext .js,.ts,.mjs,.cjs",
"build:types": "tsc --build",
"build:client": "rollup --config && babel ./addon --out-dir addon --plugins=../private-build-infra/src/transforms/babel-plugin-transform-ext.js",
"_build": "pnpm build:client && pnpm build:types",
"_build": "bun run build:client && bun run build:types",
"prepack": "pnpm build",
"_syncPnpm": "pnpm sync-dependencies-meta-injected"
"_syncPnpm": "bun run sync-dependencies-meta-injected"
},
"ember-addon": {
"main": "addon-main.js",
Expand Down
10 changes: 10 additions & 0 deletions packages/adapter/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,14 @@
"@ember-data/env": ["../private-build-infra/virtual-packages/env.d.ts"],
}
},
"references": [
{ "path": "../graph" },
{ "path": "../json-api" },
{ "path": "../legacy-compat" },
{ "path": "../request" },
{ "path": "../request-utils" },
{ "path": "../store" },
{ "path": "../tracking" },
{ "path": "../core-types" },
]
}
4 changes: 2 additions & 2 deletions packages/core-types/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
"lint": "eslint . --quiet --cache --cache-strategy=content --ext .js,.ts,.mjs,.cjs",
"build:types": "tsc --build",
"build:client": "rollup --config && babel ./addon --out-dir addon --plugins=../private-build-infra/src/transforms/babel-plugin-transform-ext.js",
"_build": "pnpm build:client && pnpm build:types",
"_build": "bun run build:client && bun run build:types",
"prepack": "pnpm build",
"_syncPnpm": "pnpm sync-dependencies-meta-injected"
"_syncPnpm": "bun run sync-dependencies-meta-injected"
},
"files": [
"addon",
Expand Down
2 changes: 1 addition & 1 deletion packages/core-types/src/cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ export interface Cache {
* @param field
* @returns {unknown}
*/
getAttr(identifier: StableRecordIdentifier, field: string): unknown;
getAttr(identifier: StableRecordIdentifier, field: string): Value | undefined;

/**
* Mutate the data for an attribute in the cache
Expand Down
2 changes: 1 addition & 1 deletion packages/debug/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"directories": {},
"scripts": {
"lint": "eslint . --quiet --cache --cache-strategy=content --ext .js,.ts,.mjs,.cjs",
"_syncPnpm": "pnpm sync-dependencies-meta-injected"
"_syncPnpm": "bun run sync-dependencies-meta-injected"
},
"peerDependencies": {
"@ember-data/store": "workspace:5.5.0-alpha.11",
Expand Down
4 changes: 2 additions & 2 deletions packages/diagnostic/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@
"build:tests": "rm -rf dist-test && cp -R test dist-test && mkdir -p dist-test/@warp-drive && cp -R dist dist-test/@warp-drive/diagnostic",
"build:types": "tsc --build",
"build:runtime": "rollup --config",
"_build": "pnpm build:runtime && pnpm build:types",
"_build": "bun run build:runtime && bun run build:types",
"start": "rollup --config --watch",
"prepack": "pnpm build",
"_syncPnpm": "pnpm sync-dependencies-meta-injected"
"_syncPnpm": "bun run sync-dependencies-meta-injected"
},
"peerDependencies": {
"@ember/test-helpers": ">= 3.2.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-plugin-ember-data/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@
"pnpm-sync-dependencies-meta-injected": "0.0.10"
},
"scripts": {
"_syncPnpm": "pnpm sync-dependencies-meta-injected"
"_syncPnpm": "bun run sync-dependencies-meta-injected"
}
}
4 changes: 2 additions & 2 deletions packages/graph/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
"lint": "eslint . --quiet --cache --cache-strategy=content --ext .js,.ts,.mjs,.cjs",
"build:types": "tsc --build",
"build:client": "rollup --config && babel ./addon --out-dir addon --plugins=../private-build-infra/src/transforms/babel-plugin-transform-ext.js",
"_build": "pnpm build:client && pnpm build:types",
"_build": "bun run build:client && bun run build:types",
"prepack": "pnpm build",
"_syncPnpm": "pnpm sync-dependencies-meta-injected"
"_syncPnpm": "bun run sync-dependencies-meta-injected"
},
"files": [
"unstable-preview-types",
Expand Down
6 changes: 6 additions & 0 deletions packages/graph/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,10 @@
"@ember-data/env": ["../private-build-infra/virtual-packages/env.d.ts"],
}
},
"references": [
{ "path": "../request" },
{ "path": "../store" },
{ "path": "../tracking" },
{ "path": "../core-types" },
]
}
4 changes: 2 additions & 2 deletions packages/holodeck/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@
"scripts": {
"build:types": "tsc --build",
"build:client": "rollup --config",
"_build": "pnpm build:client && pnpm build:types",
"_build": "bun run build:client && bun run build:types",
"start": "rollup --config --watch",
"prepack": "pnpm build",
"_syncPnpm": "pnpm sync-dependencies-meta-injected"
"_syncPnpm": "bun run sync-dependencies-meta-injected"
},
"peerDependencies": {
"@ember-data/request": "workspace:5.5.0-alpha.11",
Expand Down
6 changes: 5 additions & 1 deletion packages/holodeck/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,9 @@
"inlineSources": true,

"baseUrl": "client"
}
},
"references": [
{ "path": "../request" },
{ "path": "../core-types" },
]
}
4 changes: 2 additions & 2 deletions packages/json-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
"lint": "eslint . --quiet --cache --cache-strategy=content --ext .js,.ts,.mjs,.cjs",
"build:types": "tsc --build",
"build:client": "rollup --config && babel ./addon --out-dir addon --plugins=../private-build-infra/src/transforms/babel-plugin-transform-ext.js",
"_build": "pnpm build:client && pnpm build:types",
"_build": "bun run build:client && bun run build:types",
"prepack": "pnpm build",
"_syncPnpm": "pnpm sync-dependencies-meta-injected"
"_syncPnpm": "bun run sync-dependencies-meta-injected"
},
"ember-addon": {
"main": "addon-main.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/json-api/src/-private/cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1086,7 +1086,7 @@ export default class JSONAPICache implements Cache {
* @param field
* @returns {unknown}
*/
getAttr(identifier: StableRecordIdentifier, attr: string): unknown {
getAttr(identifier: StableRecordIdentifier, attr: string): Value | undefined {
const cached = this.__peek(identifier, true);
if (cached.localAttrs && attr in cached.localAttrs) {
return cached.localAttrs[attr];
Expand Down
8 changes: 8 additions & 0 deletions packages/json-api/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,12 @@
"@ember-data/env": ["../private-build-infra/virtual-packages/env.d.ts"],
}
},
"references": [
{ "path": "../graph" },
{ "path": "../request" },
{ "path": "../request-utils" },
{ "path": "../store" },
{ "path": "../tracking" },
{ "path": "../core-types" },
]
}
4 changes: 2 additions & 2 deletions packages/legacy-compat/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@
"lint": "eslint . --quiet --cache --cache-strategy=content --ext .js,.ts,.mjs,.cjs",
"build:types": "tsc --build",
"build:client": "rollup --config && babel ./addon --out-dir addon --plugins=../private-build-infra/src/transforms/babel-plugin-transform-ext.js",
"_build": "pnpm build:client && pnpm build:types",
"_build": "bun run build:client && bun run build:types",
"prepack": "pnpm build",
"_syncPnpm": "pnpm sync-dependencies-meta-injected"
"_syncPnpm": "bun run sync-dependencies-meta-injected"
},
"ember-addon": {
"main": "addon-main.js",
Expand Down
9 changes: 9 additions & 0 deletions packages/legacy-compat/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,13 @@
"@ember-data/env": ["../private-build-infra/virtual-packages/env.d.ts"],
}
},
"references": [
{ "path": "../graph" },
{ "path": "../json-api" },
{ "path": "../request" },
{ "path": "../request-utils" },
{ "path": "../store" },
{ "path": "../tracking" },
{ "path": "../core-types" },
]
}
6 changes: 3 additions & 3 deletions packages/model/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
"scripts": {
"lint": "eslint . --quiet --cache --cache-strategy=content --ext .js,.ts,.mjs,.cjs",
"move-dts": "bun ../../scripts/copy-declarations.mjs src",
"build:types": "tsc --build && pnpm move-dts",
"build:types": "tsc --build && bun run move-dts",
"build:client": "rollup --config && babel ./addon --out-dir addon --plugins=../private-build-infra/src/transforms/babel-plugin-transform-ext.js",
"_build": "pnpm build:client && pnpm build:types",
"_build": "bun run build:client && bun run build:types",
"prepack": "pnpm build",
"_syncPnpm": "pnpm sync-dependencies-meta-injected"
"_syncPnpm": "bun run sync-dependencies-meta-injected"
},
"ember-addon": {
"main": "addon-main.js",
Expand Down
10 changes: 10 additions & 0 deletions packages/model/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,14 @@
"@ember-data/env": ["../private-build-infra/virtual-packages/env.d.ts"],
}
},
"references": [
{ "path": "../graph" },
{ "path": "../json-api" },
{ "path": "../legacy-compat" },
{ "path": "../request" },
{ "path": "../request-utils" },
{ "path": "../store" },
{ "path": "../tracking" },
{ "path": "../core-types" },
]
}
2 changes: 1 addition & 1 deletion packages/private-build-infra/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"author": "",
"directories": {},
"scripts": {
"_syncPnpm": "pnpm sync-dependencies-meta-injected"
"_syncPnpm": "bun run sync-dependencies-meta-injected"
},
"dependencies": {
"@babel/core": "^7.23.2",
Expand Down
4 changes: 2 additions & 2 deletions packages/request-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@
"lint": "eslint . --quiet --cache --cache-strategy=content --ext .js,.ts,.mjs,.cjs",
"build:types": "tsc --build",
"build:client": "rollup --config && babel ./addon --out-dir addon --plugins=../private-build-infra/src/transforms/babel-plugin-transform-ext.js",
"_build": "pnpm build:client && pnpm build:types",
"_build": "bun run build:client && bun run build:types",
"prepack": "pnpm build",
"_syncPnpm": "pnpm sync-dependencies-meta-injected"
"_syncPnpm": "bun run sync-dependencies-meta-injected"
},
"ember-addon": {
"main": "addon-main.js",
Expand Down
5 changes: 4 additions & 1 deletion packages/request-utils/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,8 @@
"types": [
"ember-source/types"
]
}
},
"references": [
{ "path": "../core-types" },
]
}
4 changes: 2 additions & 2 deletions packages/request/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
"lint": "eslint . --quiet --cache --cache-strategy=content --ext .js,.ts,.mjs,.cjs",
"build:types": "tsc --build",
"build:client": "rollup --config && babel ./addon --out-dir addon --plugins=../private-build-infra/src/transforms/babel-plugin-transform-ext.js",
"_build": "pnpm build:client && pnpm build:types",
"_build": "bun run build:client && bun run build:types",
"prepack": "pnpm build",
"_syncPnpm": "pnpm sync-dependencies-meta-injected"
"_syncPnpm": "bun run sync-dependencies-meta-injected"
},
"files": [
"unstable-preview-types",
Expand Down
5 changes: 4 additions & 1 deletion packages/request/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,8 @@
"paths": {
"@ember-data/env": ["../../private-build-infra/virtual-packages/env.d.ts"],
}
}
},
"references": [
{ "path": "../core-types" },
]
}
4 changes: 2 additions & 2 deletions packages/rest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@
"lint": "eslint . --quiet --cache --cache-strategy=content --ext .js,.ts,.mjs,.cjs",
"build:types": "tsc --build",
"build:client": "rollup --config && babel ./addon --out-dir addon --plugins=../private-build-infra/src/transforms/babel-plugin-transform-ext.js",
"_build": "pnpm build:client && pnpm build:types",
"_build": "bun run build:client && bun run build:types",
"prepack": "pnpm build",
"_syncPnpm": "pnpm sync-dependencies-meta-injected"
"_syncPnpm": "bun run sync-dependencies-meta-injected"
},
"ember-addon": {
"main": "addon-main.js",
Expand Down
7 changes: 7 additions & 0 deletions packages/rest/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,11 @@
"@ember-data/env": ["../private-build-infra/virtual-packages/env.d.ts"],
}
},
"references": [
{ "path": "../request" },
{ "path": "../request-utils" },
{ "path": "../store" },
{ "path": "../tracking" },
{ "path": "../core-types" },
]
}
26 changes: 26 additions & 0 deletions packages/schema-record/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
const imports = require('@warp-drive/internal-config/eslint/imports.cjs');
const parser = require('@warp-drive/internal-config/eslint/parser.cjs');
const isolation = require('@warp-drive/internal-config/eslint/isolation.cjs');
const ignore = require('@warp-drive/internal-config/eslint/ignore.cjs');
const node = require('@warp-drive/internal-config/eslint/node.cjs');
const base = require('@warp-drive/internal-config/eslint/base.cjs');
const typescript = require('@warp-drive/internal-config/eslint/typescript.cjs');

module.exports = {
...parser.defaults(),

plugins: [...base.plugins(), ...imports.plugins()],
extends: [...base.extend()],
rules: Object.assign(
base.rules(),
imports.rules(),
isolation.rules({
allowedImports: [],
}),
{}
),

ignorePatterns: ignore.ignoreRules(),

overrides: [node.defaults(), typescript.defaults()],
};
Loading

0 comments on commit 2ca4a57

Please sign in to comment.