Skip to content

Upgrade TypeScript, ESLint, and @glimmer + @glimmerx packages #33

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Dec 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
"@typescript-eslint/no-empty-interface": "off",
"@typescript-eslint/no-use-before-define": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/ban-types": "off",
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/explicit-function-return-type": [
"error",
{
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@
"yarn": "1.22.4"
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^2.31.0",
"@typescript-eslint/parser": "^2.31.0",
"eslint": "^6.8.0",
"@typescript-eslint/eslint-plugin": "^4.9.0",
"@typescript-eslint/parser": "^4.9.0",
"eslint": "^7.15.0",
"prettier": "^2.1.1",
"release-it": "^13.6.3",
"release-it-lerna-changelog": "^2.3.0",
"release-it-yarn-workspaces": "^1.4.0",
"typescript": "^3.9.5"
"typescript": "^4.1.2"
},
"version": "0.2.1"
}
1 change: 1 addition & 0 deletions packages/cli/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/lib/
2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"glint": "bin/glint.js"
},
"scripts": {
"lint": "eslint . --ext ts --max-warnings 0 && prettier --check src",
"lint": "eslint . --max-warnings 0 && prettier --check src",
"test": "jest",
"build": "tsc --build",
"prepack": "yarn build"
Expand Down
1 change: 1 addition & 0 deletions packages/config/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/lib/
1 change: 1 addition & 0 deletions packages/config/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-env node */
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
Expand Down
2 changes: 1 addition & 1 deletion packages/config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"lib"
],
"scripts": {
"lint": "eslint . --ext ts --max-warnings 0 && prettier --check src",
"lint": "eslint . --max-warnings 0 && prettier --check src",
"test": "jest",
"build": "tsc --build",
"prepack": "yarn build"
Expand Down
2 changes: 2 additions & 0 deletions packages/environment-ember-loose/lib/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import { GlintEnvironmentConfig } from '@glint/config';
export default function glimmerxEnvironment(): GlintEnvironmentConfig;
34 changes: 34 additions & 0 deletions packages/environment-ember-loose/lib/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const path_1 = __importDefault(require("path"));
function glimmerxEnvironment() {
return {
template: {
typesPath: '@glint/environment-ember-loose/types',
getPossibleScriptPaths(templatePath) {
if (templatePath.endsWith(`${path_1.default.sep}template.hbs`)) {
// Pod component
return [templatePath.replace(/template\.hbs$/, 'component.ts')];
}
else {
// Colocated component
return [templatePath.replace(/\.hbs$/, '.ts')];
}
},
getPossibleTemplatePaths(scriptPath) {
if (scriptPath.endsWith(`${path_1.default.sep}component.ts`)) {
// Pod component
return [scriptPath.replace(/component\.ts$/, 'template.hbs')];
}
else {
// Colocated component
return [scriptPath.replace(/\.ts$/, '.hbs')];
}
},
},
};
}
exports.default = glimmerxEnvironment;
8,496 changes: 8,496 additions & 0 deletions packages/environment-ember-loose/tsconfig.tsbuildinfo

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions packages/environment-glimmerx/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/lib/
6 changes: 3 additions & 3 deletions packages/environment-glimmerx/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"glint-environment"
],
"scripts": {
"lint": "eslint . --ext ts --max-warnings 0 && prettier --check src",
"lint": "eslint . --max-warnings 0 && prettier --check src",
"test": "tsc --project __tests__",
"build": "tsc --build",
"prepack": "yarn build"
Expand All @@ -25,8 +25,8 @@
"@glint/template": "^0.2.1"
},
"devDependencies": {
"expect-type": "0.7.3",
"@glimmerx/component": "^0.2.2"
"@glimmerx/component": "^0.3.0",
"expect-type": "0.7.3"
},
"publishConfig": {
"access": "public"
Expand Down
1 change: 1 addition & 0 deletions packages/template/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/lib/
2 changes: 1 addition & 1 deletion packages/template/__tests__/keywords/component.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ invokeBlock(resolve(NoopCurriedStringComponent)({ value: 'hello' }), {
default() {
/* nothing */
},
// @ts-expect-error
// @ts-expect-error: invalid block name
asdf() {
/* nothing */
},
Expand Down
6 changes: 3 additions & 3 deletions packages/template/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"author": "Dan Freeman (https://github.com/dfreeman)",
"types": "index.d.ts",
"scripts": {
"lint": "eslint . --ext ts --max-warnings 0 && prettier --check .",
"lint": "eslint . --max-warnings 0 && prettier --check .",
"test": "tsc --project __tests__"
},
"files": [
Expand All @@ -16,8 +16,8 @@
"*.d.ts"
],
"devDependencies": {
"@glimmer/component": "^1.0.0",
"@glimmerx/component": "^0.2.2",
"@glimmer/component": "^1.0.2",
"@glimmerx/component": "^0.3.0",
"@types/ember__component": "~3.0.7",
"expect-type": "0.7.3",
"sums-up": "^2.1.0"
Expand Down
1 change: 1 addition & 0 deletions packages/transform/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/lib/
1 change: 1 addition & 0 deletions packages/transform/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-env node */
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
Expand Down
4 changes: 2 additions & 2 deletions packages/transform/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"lib"
],
"scripts": {
"lint": "eslint . --ext ts --max-warnings 0 && prettier --check src",
"lint": "eslint . --max-warnings 0 && prettier --check src",
"test": "jest",
"build": "tsc --build",
"prepack": "yarn build"
Expand All @@ -21,7 +21,7 @@
"@babel/core": "^7.11.6",
"@babel/plugin-proposal-decorators": "7.10.5",
"@babel/preset-typescript": "^7.10.4",
"@glimmer/syntax": "^0.54.0",
"@glimmer/syntax": "^0.68.1",
"@glint/config": "^0.2.1",
"debug": "^4.1.1"
},
Expand Down
2 changes: 0 additions & 2 deletions packages/transform/src/template-to-typescript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,8 @@ export function templateToTypescript(

function emitTopLevelStatement(node: AST.TopLevelStatement): void {
switch (node.type) {
case 'AttrNode':
case 'Block':
case 'PartialStatement':
case 'Template':
throw new Error(`Internal error: unexpected top-level ${node.type}`);

case 'TextNode':
Expand Down
1 change: 1 addition & 0 deletions packages/tsserver-plugin/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/lib/
2 changes: 1 addition & 1 deletion packages/tsserver-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"lib"
],
"scripts": {
"lint": "eslint . --ext ts --max-warnings 0 && prettier --check src",
"lint": "eslint . --max-warnings 0 && prettier --check src",
"test": "jest",
"build": "tsc --build",
"prepack": "yarn build"
Expand Down
4 changes: 2 additions & 2 deletions packages/tsserver-plugin/src/language-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,14 @@ export default class GlintLanguageService implements Partial<ts.LanguageService>
public getSyntacticDiagnostics(fileName: string): ts.DiagnosticWithLocation[] {
let info = this.getTransformInfoForOriginalPath(fileName);
let transformationErrors = info?.transformedModule?.errors ?? [];
let originalSourceFile = this.ls.getProgram()?.getSourceFile(fileName)!;
let originalSourceFile = this.ls.getProgram()?.getSourceFile(fileName);

return [
...this.ls.getSyntacticDiagnostics(fileName),
...transformationErrors.map((error) => ({
category: this.ts.DiagnosticCategory.Error,
code: 0,
file: originalSourceFile,
file: originalSourceFile!,
start: error.location.start,
length: error.location.end - error.location.start,
messageText: `[glint] ${error.message}`,
Expand Down
35 changes: 19 additions & 16 deletions test-packages/demo-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
"scripts": {
"build": "NODE_ENV=production webpack",
"lint": "eslint . --ext=js,ts --cache",
"lint": "eslint . --cache",
"start": "webpack-dev-server",
"typecheck": "glint",
"test": "npm-run-all typecheck test:browsers",
Expand All @@ -21,29 +21,29 @@
"@babel/plugin-proposal-decorators": "^7.8.3",
"@babel/preset-env": "^7.9.0",
"@babel/preset-typescript": "^7.10.1",
"@glimmer/babel-plugin-glimmer-env": "~2.0.0-beta.7",
"@glimmer/bundle-compiler": "^0.54.0",
"@glimmer/babel-plugin-glimmer-env": "~2.0.0-beta.1",
"@glimmer/bundle-compiler": "^0.59.1",
"@glimmer/env": "^0.1.7",
"@glimmerx/babel-plugin-component-templates": "^0.2.3",
"@glimmerx/component": "^0.2.3",
"@glimmerx/core": "^0.2.3",
"@glimmerx/eslint-plugin": "^0.2.3",
"@glimmerx/helper": "^0.2.3",
"@glimmerx/modifier": "^0.2.3",
"@glimmerx/service": "^0.2.3",
"@glimmerx/babel-plugin-component-templates": "^0.3.0",
"@glimmerx/component": "^0.3.0",
"@glimmerx/core": "^0.3.0",
"@glimmerx/eslint-plugin": "^0.3.0",
"@glimmerx/helper": "^0.3.0",
"@glimmerx/modifier": "^0.3.0",
"@glimmerx/service": "^0.3.0",
"@glint/cli": "^0.2.1",
"@glint/environment-glimmerx": "^0.2.1",
"@glint/tsserver-plugin": "^0.2.1",
"@types/qunit": "^2.9.1",
"@typescript-eslint/eslint-plugin": "^2.26.0",
"@typescript-eslint/parser": "^2.26.0",
"@typescript-eslint/eslint-plugin": "^4.9.0",
"@typescript-eslint/parser": "^4.9.0",
"babel-loader": "^8.1.0",
"clean-webpack-plugin": "^3.0.0",
"copy-webpack-plugin": "^5.1.1",
"css-loader": "^3.4.2",
"eslint": "^6.8.0",
"eslint-config-prettier": "^6.10.1",
"eslint-plugin-prettier": "^3.1.2",
"eslint": "^7.15.0",
"eslint-config-prettier": "^7.0.0",
"eslint-plugin-prettier": "^3.2.0",
"file-loader": "^6.0.0",
"glob": "7.1.6",
"html-webpack-plugin": "^4.0.4",
Expand Down Expand Up @@ -92,7 +92,10 @@
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"prettier/@typescript-eslint"
]
],
"rules": {
"@typescript-eslint/ban-types": "off"
}
},
{
"files": [
Expand Down
2 changes: 0 additions & 2 deletions test-packages/demo-app/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint-disable @typescript-eslint/no-var-requires */

const path = require('path');
const glob = require('glob');
const HtmlWebpackPlugin = require('html-webpack-plugin');
Expand Down
3 changes: 0 additions & 3 deletions tsconfig.compileroptions.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,5 @@
"esModuleInterop": true,
"composite": true,
"declaration": true,
// Not ideal, but several of the @glimmer packages fairly consistently
// produce type errors across different versions.
"skipLibCheck": true
}
}
Loading