Skip to content

Commit e7d15fe

Browse files
authored
Merge pull request #2109 from hashicorp/feat/showcase-ts-tooling
feat(showcase): add typescript tooling
2 parents 2fa9211 + a992df6 commit e7d15fe

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+260
-232
lines changed

.github/workflows/ci-components.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,18 +42,18 @@ jobs:
4242
cache-dependency-path: yarn.lock
4343
- name: Install Dependencies
4444
run: yarn install --immutable
45-
- name: Lint Showcase
46-
run: yarn run lint
47-
working-directory: showcase
48-
- name: Lint Components
49-
run: yarn run lint
50-
working-directory: packages/components
5145
- name: Build Icons
5246
run: yarn build
5347
working-directory: packages/ember-flight-icons
5448
- name: Build Components
5549
run: yarn build
5650
working-directory: packages/components
51+
- name: Lint Showcase
52+
run: yarn run lint
53+
working-directory: showcase
54+
- name: Lint Components
55+
run: yarn run lint
56+
working-directory: packages/components
5757
- name: Run Tests
5858
run: yarn run test:ember:percy
5959
working-directory: showcase
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
diff --git a/-private/environment/index.js b/-private/environment/index.js
2+
index 217583f4bae53f6f72db8d3debd0f31b3dac2b8e..8caf5463cf2be2248952c2347c738b98d2b7e22b 100644
3+
--- a/-private/environment/index.js
4+
+++ b/-private/environment/index.js
5+
@@ -46,10 +46,8 @@ function emberLooseEnvironment(options) {
6+
// Pod component/controller/route
7+
candidates.push(templatePath.replace(REGEXES.POD_TEMPLATE, '/component.ts'), templatePath.replace(REGEXES.POD_TEMPLATE, '/controller.ts'), templatePath.replace(REGEXES.POD_TEMPLATE, '/route.ts'));
8+
}
9+
- else if (templatePath.includes('/templates/components/')) {
10+
- // Classic component
11+
- candidates.push(colocatedTsScriptPath.replace('/templates/components/', '/components/'));
12+
- }
13+
+ // we no longer need this as it remnant of classic components and it interferes with our route stricture in showcase up
14+
+ // upstream PR: https://github.com/typed-ember/glint/pull/721
15+
else if (templatePath.includes('/templates/')) {
16+
// Classic controller/route
17+
candidates.push(colocatedTsScriptPath.replace('/templates/', '/controllers/'), colocatedTsScriptPath.replace('/templates/', '/routes/'));

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
},
1818
"packageManager": "yarn@4.0.2",
1919
"resolutions": {
20-
"broccoli-asset-rewrite@^2.0.0": "patch:broccoli-asset-rewrite@npm%3A2.0.0#./.yarn/patches/broccoli-asset-rewrite-npm-2.0.0-c4ce42084a.patch"
20+
"broccoli-asset-rewrite@^2.0.0": "patch:broccoli-asset-rewrite@npm%3A2.0.0#./.yarn/patches/broccoli-asset-rewrite-npm-2.0.0-c4ce42084a.patch",
21+
"@glint/environment-ember-loose": "patch:@glint/environment-ember-loose@npm%3A1.4.0#~/.yarn/patches/@glint-environment-ember-loose-npm-1.4.0-31c2f31bcb.patch"
2122
}
2223
}

showcase/.editorconfig

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# EditorConfig helps developers define and maintain consistent
2+
# coding styles between different editors and IDEs
3+
# editorconfig.org
4+
5+
root = true
6+
7+
[*]
8+
end_of_line = lf
9+
charset = utf-8
10+
trim_trailing_whitespace = true
11+
insert_final_newline = true
12+
indent_style = space
13+
indent_size = 2
14+
15+
[*.hbs]
16+
insert_final_newline = false
17+
18+
[*.{diff,md}]
19+
trim_trailing_whitespace = false

showcase/.ember-cli

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
"disableAnalytics": true,
99

1010
/**
11-
Setting `isTypeScriptProject` to true will force the blueprint generators to generate TypeScript
12-
rather than JavaScript by default, when a TypeScript version of a given blueprint is available.
11+
Setting `isTypeScriptProject` to true will force the blueprint generators to generate TypeScript
12+
rather than JavaScript by default, when a TypeScript version of a given blueprint is available.
1313
*/
14-
"isTypeScriptProject": false
14+
"isTypeScriptProject": true
1515
}

showcase/.eslintignore

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,13 @@
11
# unconventional js
22
/blueprints/*/files/
3-
/vendor/
43

54
# compiled output
65
/dist/
7-
/tmp/
8-
9-
# dependencies
10-
/bower_components/
11-
/node_modules/
126

137
# misc
148
/coverage/
159
!.*
1610
.*/
17-
.eslintcache
1811

1912
# ember-try
2013
/.node_modules.ember-try/
21-
/bower.json.ember-try
22-
/npm-shrinkwrap.json.ember-try
23-
/package.json.ember-try
24-
/package-lock.json.ember-try
25-
/yarn.lock.ember-try

showcase/.eslintrc.js

Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,11 @@
22

33
module.exports = {
44
root: true,
5-
parser: '@babel/eslint-parser',
5+
parser: '@typescript-eslint/parser',
66
parserOptions: {
7-
ecmaVersion: 2018,
8-
sourceType: 'module',
9-
ecmaFeatures: {
10-
legacyDecorators: true,
11-
},
12-
requireConfigFile: false,
13-
babelOptions: {
14-
plugins: [['@babel/plugin-proposal-decorators', { legacy: true }]],
15-
},
7+
ecmaVersion: 'latest',
168
},
17-
plugins: ['ember'],
9+
plugins: ['ember', '@typescript-eslint'],
1810
extends: [
1911
'eslint:recommended',
2012
'plugin:ember/recommended',
@@ -25,6 +17,15 @@ module.exports = {
2517
},
2618
rules: {},
2719
overrides: [
20+
// ts files
21+
{
22+
files: ['**/*.ts'],
23+
extends: [
24+
'plugin:@typescript-eslint/eslint-recommended',
25+
'plugin:@typescript-eslint/recommended',
26+
],
27+
rules: {},
28+
},
2829
// node files
2930
{
3031
files: [
@@ -33,26 +34,16 @@ module.exports = {
3334
'./.stylelintrc.js',
3435
'./.template-lintrc.js',
3536
'./ember-cli-build.js',
36-
'./index.js',
3737
'./testem.js',
3838
'./blueprints/*/index.js',
3939
'./config/**/*.js',
4040
'./tests/dummy/config/**/*.js',
4141
],
42-
parserOptions: {
43-
sourceType: 'script',
44-
},
4542
env: {
4643
browser: false,
4744
node: true,
4845
},
49-
plugins: ['node'],
50-
extends: ['plugin:node/recommended'],
51-
rules: {
52-
// this can be removed once the following is fixed
53-
// https://github.com/mysticatea/eslint-plugin-node/issues/77
54-
'node/no-unpublished-require': 'off',
55-
},
46+
extends: ['plugin:n/recommended'],
5647
},
5748
{
5849
// test files

showcase/.gitignore

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,21 @@
1-
# See https://help.github.com/ignore-files/ for more about ignoring files.
2-
31
# compiled output
42
/dist/
53
/declarations/
64

75
# dependencies
8-
/bower_components/
96
/node_modules/
107

118
# misc
129
/.env*
1310
/.pnp*
14-
/.sass-cache
1511
/.eslintcache
16-
/connect.lock
1712
/coverage/
18-
/libpeerconnection.log
1913
/npm-debug.log*
2014
/testem.log
2115
/yarn-error.log
2216

2317
# ember-try
2418
/.node_modules.ember-try/
25-
/bower.json.ember-try
2619
/npm-shrinkwrap.json.ember-try
2720
/package.json.ember-try
2821
/package-lock.json.ember-try

showcase/.prettierignore

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,13 @@
11
# unconventional js
22
/blueprints/*/files/
3-
/vendor/
43

54
# compiled output
65
/dist/
7-
/tmp/
8-
9-
# dependencies
10-
/bower_components/
11-
/node_modules/
126

137
# misc
148
/coverage/
159
!.*
16-
.eslintcache
17-
.lint-todo/
10+
.*/
1811

1912
# ember-try
2013
/.node_modules.ember-try/
21-
/bower.json.ember-try
22-
/npm-shrinkwrap.json.ember-try
23-
/package.json.ember-try
24-
/package-lock.json.ember-try
25-
/yarn.lock.ember-try

showcase/.prettierrc.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,17 @@
11
'use strict';
22

33
module.exports = {
4-
singleQuote: true,
54
overrides: [
65
{
7-
files: '*.hbs',
6+
files: '*.{js,ts}',
87
options: {
9-
singleQuote: false,
10-
printWidth: 120,
8+
singleQuote: true,
119
},
1210
},
1311
{
14-
files: '*.scss',
12+
files: '*.hbs',
1513
options: {
16-
singleQuote: false,
14+
printWidth: 120,
1715
},
1816
},
1917
],

showcase/.stylelintignore

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,8 @@
1-
# unconventional js
1+
# unconventional files
22
/blueprints/*/files/
3-
/vendor/
43

54
# compiled output
65
/dist/
7-
/tmp/
86

9-
# dependencies
10-
/bower_components/
11-
/node_modules/
12-
13-
# misc
14-
/coverage/
15-
!.*
16-
.*/
17-
.eslintcache
18-
.lint-todo/
19-
20-
# ember-try
7+
# addons
218
/.node_modules.ember-try/
22-
/bower.json.ember-try
23-
/npm-shrinkwrap.json.ember-try
24-
/package.json.ember-try
25-
/package-lock.json.ember-try
26-
/yarn.lock.ember-try
File renamed without changes.

showcase/app/config/environment.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
/**
22
* Type declarations for
3-
* import config from 'my-app/config/environment'
3+
* import config from 'showcase/config/environment'
44
*/
55
declare const config: {
66
environment: string;
77
modulePrefix: string;
88
podModulePrefix: string;
9-
locationType: 'history' | 'hash' | 'none' | 'auto';
9+
locationType: 'history' | 'hash' | 'none';
1010
rootURL: string;
1111
APP: Record<string, unknown>;
1212
};
File renamed without changes.

showcase/app/templates/components/accordion.hbs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
{{! @glint-nocheck: not typesafe yet }}
21
{{!
32
Copyright (c) HashiCorp, Inc.
43
SPDX-License-Identifier: MPL-2.0

showcase/app/templates/components/alert.hbs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
{{! @glint-nocheck: not typesafe yet }}
21
{{!
32
Copyright (c) HashiCorp, Inc.
43
SPDX-License-Identifier: MPL-2.0

showcase/app/templates/components/app-footer.hbs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
{{! @glint-nocheck: not typesafe yet }}
21
{{!
32
Copyright (c) HashiCorp, Inc.
43
SPDX-License-Identifier: MPL-2.0

showcase/app/templates/components/application-state.hbs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
{{! @glint-nocheck: not typesafe yet }}
21
{{!
32
Copyright (c) HashiCorp, Inc.
43
SPDX-License-Identifier: MPL-2.0

showcase/app/templates/components/badge-count.hbs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
{{! @glint-nocheck: not typesafe yet }}
21
{{!
32
Copyright (c) HashiCorp, Inc.
43
SPDX-License-Identifier: MPL-2.0

showcase/app/templates/components/badge.hbs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
{{! @glint-nocheck: not typesafe yet }}
21
{{!
32
Copyright (c) HashiCorp, Inc.
43
SPDX-License-Identifier: MPL-2.0

showcase/app/templates/components/button-set.hbs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
{{! @glint-nocheck: not typesafe yet }}
21
{{!
32
Copyright (c) HashiCorp, Inc.
43
SPDX-License-Identifier: MPL-2.0

showcase/app/templates/components/button.hbs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
{{! @glint-nocheck: not typesafe yet }}
21
{{!
32
Copyright (c) HashiCorp, Inc.
43
SPDX-License-Identifier: MPL-2.0

showcase/app/templates/components/card.hbs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
{{! @glint-nocheck: not typesafe yet }}
21
{{!
32
Copyright (c) HashiCorp, Inc.
43
SPDX-License-Identifier: MPL-2.0

showcase/app/templates/components/code-block.hbs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
{{! @glint-nocheck: not typesafe yet }}
21
{{!
3-
Copyright (c) HashiCorp, Inc.
4-
SPDX-License-Identifier: MPL-2.0
2+
Copyright (c) HashiCorp, Inc.
3+
SPDX-License-Identifier: MPL-2.0
54
}}
65

76
{{page-title "CodeBlock Component"}}

showcase/app/templates/components/copy/button.hbs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
{{! @glint-nocheck: not typesafe yet }}
21
{{!
32
Copyright (c) HashiCorp, Inc.
43
SPDX-License-Identifier: MPL-2.0

showcase/app/templates/components/copy/snippet.hbs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
{{! @glint-nocheck: not typesafe yet }}
21
{{!
32
Copyright (c) HashiCorp, Inc.
43
SPDX-License-Identifier: MPL-2.0

showcase/app/templates/components/dropdown.hbs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
{{! @glint-nocheck: not typesafe yet }}
21
{{!
32
Copyright (c) HashiCorp, Inc.
43
SPDX-License-Identifier: MPL-2.0

showcase/app/templates/components/flyout.hbs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
{{! @glint-nocheck: not typesafe yet }}
21
{{!
32
Copyright (c) HashiCorp, Inc.
43
SPDX-License-Identifier: MPL-2.0

showcase/app/templates/components/form/base-elements.hbs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
{{! @glint-nocheck: not typesafe yet }}
21
{{!
32
Copyright (c) HashiCorp, Inc.
43
SPDX-License-Identifier: MPL-2.0

showcase/app/templates/components/form/checkbox.hbs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
{{! @glint-nocheck: not typesafe yet }}
21
{{!
32
Copyright (c) HashiCorp, Inc.
43
SPDX-License-Identifier: MPL-2.0

showcase/app/templates/components/form/file-input.hbs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
{{! @glint-nocheck: not typesafe yet }}
21
{{!
32
Copyright (c) HashiCorp, Inc.
43
SPDX-License-Identifier: MPL-2.0

showcase/app/templates/components/form/masked-input.hbs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
{{! @glint-nocheck: not typesafe yet }}
21
{{!
32
Copyright (c) HashiCorp, Inc.
43
SPDX-License-Identifier: MPL-2.0

0 commit comments

Comments
 (0)