Skip to content

Commit

Permalink
Fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
gitKrystan committed Oct 22, 2023
1 parent d0bbe4e commit 3fefd39
Show file tree
Hide file tree
Showing 17 changed files with 127 additions and 112 deletions.
98 changes: 58 additions & 40 deletions .local.dic
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
*google
*NPM
2FA
30KB
activations
acyclic
ActiveSupport
acyclic
Algolia
asynchronicity
Americentric
asynchronicity
asynchrony
autocomplete
autotrack
auto-rollup
autocomplete
autocompletion
autoruns
autotrack
autotracking
aXe
backticks
Expand All @@ -24,8 +27,8 @@ camelize
Chai
chainable
cheatsheet
Checkboxes
checkboxes
Checkboxes
coc-ember
CoffeeScript
ColorSafe
Expand All @@ -44,31 +47,37 @@ datepicker
de
debounce
declaratively
DefinitelyTyped
deps
draggable
dropdown
durations
dynamicness
EditorConfig
els-addon-docs
els-addon-typed-templates
enumerables
ember-a11y
ember-a11y-refocus
ember-a11y-testing
ember-cli-deprecation-workflow
ember-cli-cjs-transform
ember-cli-deprecation-workflow
ember-cli-document-title
ember-cli-head
ember-cli-htmlbars
ember-cli-netlify
ember-cli-mirage.
ember-cli-netlify
ember-cli-tutorial-style
ember-cli-typescript
ember-debug-handlers-polyfill
ember-fast-cli
ember-intl
EmberData
EmberObject
enumerables
erroring
Evented
facto
fallbacks
FastPass
favicon
Favicon
Expand All @@ -82,11 +91,10 @@ geocoding
getter
getters
Getters
GitLab
GIFs
globbing
GitLab
GlimmerX
*google
globbing
hackable
HammerJS
hardcode
Expand All @@ -95,25 +103,30 @@ Hm
Hoc
htmlbars
IE11
interop
interoperable
invocable
invoker
IndexedDB
Inflector
instantiation
Intellisense
IntelliSense
interop
interoperable
invokable
invokables
invoker
invoker
invokers
JetBrains
jquery-integration
JSDoc
keyCode
KVO
lang
linters
LSP
lookups
LSP
Mapbox
MDN
metaprogramming
misspelt
mixin
mixins
Expand All @@ -123,103 +136,108 @@ natively
nav
nav-bar
Neovim
*NPM
NVDA
onboarding
Orca
page-crafter
parallelize
Param
param
params
Param
parameterizing
params
PascalCased
pipelining
PR
PRs
preload
prepend
prepended
pre-determined
pre-octane
pre-populating
pre-transition
pre-transition
preload
prepend
prepended
presentational
Presentational
pre-transition
pre-octane
PRs
readme
readonly
recognizers
recursing
Redux
relayout
renderer
repo
repos
rerender
rerenders
rerendering
rerenders
routable
RunDOC
Runnable
runnable
Runnable
runtime
sandboxed
scp
screencasting
selectable
self-referentiality
serverless
singularize
source-readibility
Splattributes
SSR
stateful
subclassed
subclasses
subclassing
subdomain
subexpression
substring
subfolders
suboptimal
subroutes
substate
substates
substring
SuperForm
superset
swappable
synergistically
syntaxes
swappable
tagless
TalkBack
teardown
template-lifecycle-dom-and-modifiers
templating
todo
todos
treesitter
triple-backtick
tooltip
trackable
Trackable
Treeshaking
treesitter
triple-backtick
typeahead
typechecker
typings
UIs
URL-escaped
un-representable
unordered
unsilence
unstyled
untracked
untrusted
URL-escaped
usecase
v1
v2
viewport
vim-ember-hbs
vim-javascript
vim-js-pretty-template
VM
Voilà
voilà
VoiceOver
voilà
Voilà
websocket
Websockets
ZEIT
yay
template-lifecycle-dom-and-modifiers
working-with-html-css-and-javascript
dropdown
yay
ZEIT
12 changes: 4 additions & 8 deletions guides/release/code-editors/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Stable Ember Language Server is a stable, full-featured language server. Its nam

### Workflow

[ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) - Integrates ESLint into VS Code.
[ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) - Integrates ESLint into VS Code.

[EditorConfig for Visual Studio Code](https://marketplace.visualstudio.com/items?itemName=EditorConfig.EditorConfig) -
Attempts to override user/workspace settings with settings found in `.editorconfig` files.
Expand All @@ -49,8 +49,7 @@ Prettier is an opinionated code formatting tool. It enforces a consistent style
</div>
</div>


[Glint](https://marketplace.visualstudio.com/items?itemName=typed-ember.glint-vscode) is a set of tools to aid in developing code that uses the Glimmer VM for rendering, such as Ember.js v3.24+ and GlimmerX projects.
[Glint](https://marketplace.visualstudio.com/items?itemName=typed-ember.glint-vscode) is a set of tools to aid in developing code that uses the Glimmer VM for rendering, such as Ember.js v3.24+ and GlimmerX projects.

## Vim and Neovim

Expand All @@ -76,10 +75,10 @@ or
[vim-ember-hbs](https://github.com/joukevandermaas/vim-ember-hbs) -
Add Ember template syntax highlighting and indentation to Vim.
To get embedded highlighting will involve these additional plugins:

- [vim-javascript](https://github.com/pangloss/vim-javascript)
- [vim-js-pretty-template](https://github.com/Quramy/vim-js-pretty-template)


### Language Server

Only one of these solutions should be used at a time.
Expand All @@ -91,21 +90,18 @@ Example mason+LSP config [can be found here](https://github.com/NullVoxPopuli/do
or

[Conquer for Completion (COC) for Neovim](https://github.com/neoclide/coc.nvim) -
An Intellisense engine which takes control over all linting, hinting, and language-server integration.
An IntelliSense engine which takes control over all linting, hinting, and language-server integration.
With the ember plugin [coc-ember](https://github.com/NullVoxPopuli/coc-ember) -
Ember.js language server extension including useful configuration instructions.

### Snippets / Workflow


[ember.vim](https://github.com/dsawardekar/ember.vim) -
Shortcuts to navigate related files with Ember.js projects.


[Ember Tools](https://github.com/AndrewRadev/ember_tools.vim) -
Various tools for working with Ember.js projects.


## Atom

Atom is hackable text editor for the 21st Century.
Expand Down
6 changes: 3 additions & 3 deletions guides/release/typescript/additional-resources/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ See ["Gradual Typing Hacks"][gradual-typing-hacks] for strategies for incrementa

### Install types for libraries

You'll want to use library type definitions as much as possible. Many packages ship their own type definitions, and many others have community-maintained definitions from [DefinitelyTyped], available in the `@types` name space. The first thing you should do is to look for types from other libraries: it will mean using fewer ["Gradual Typing Hacks"][gradual-typing-hacks] and getting a lot more help both from your editor and from the compiler.
You'll want to use library type definitions as much as possible. Many packages ship their own type definitions, and many others have community-maintained definitions from [DefinitelyTyped][], available in the `@types` name space. The first thing you should do is to look for types from other libraries: it will mean using fewer ["Gradual Typing Hacks"][gradual-typing-hacks] and getting a lot more help both from your editor and from the compiler.

### The `types` directory

Expand All @@ -21,7 +21,7 @@ These are all fallbacks, of course, you should use the types supplied directly w

At the root of your application or addon, we include a `types/<your project>` directory with an `index.d.ts` file in it. Anything which is part of your project but which must be declared globally can go in this file. For example, if you have data attached to the `Window` object when the page is loaded (for bootstrapping or whatever other reason), this is a good place to declare it.

We automatically configure `index.d.ts` to be ready for [Glint], which will make type checking work with Ember's templates. The default configuration only supports Ember's classic pairing of separate `.ts` and `.hbs` files, but Glint also supports the `<template>` format with `.gts` files. See the [corresponding package README][glint-environment-ember-template-imports] for more details. (Once Ember enables `<template>` by default, so will our Glint configuration!)
We automatically configure `index.d.ts` to be ready for [Glint][], which will make type checking work with Ember's templates. The default configuration only supports Ember's classic pairing of separate `.ts` and `.hbs` files, but Glint also supports the `<template>` format with `.gts` files. See the [corresponding package README][glint-environment-ember-template-imports] for more details. (Once Ember enables `<template>` by default, so will our Glint configuration!)

### Environment configuration typings

Expand All @@ -31,7 +31,7 @@ We install this file because the actual `config/environment.js` is (a) not actua

## Type Narrowing with Ember Debug Assert

Ember's `assert` function from `@ember/debug` is super useful for ["type narrowing"][type-narrowing]—TypeScripts process of refining types to more specific types than originally declared. If youre not familiar with `assert`, you might want to take a look at its [API docs][debug-assert]! Its a development-and-test-only helper that gets stripped from production builds, and is very helpful for this kind of thing!
Ember's `assert` function from `@ember/debug` is super useful for ["type narrowing"][type-narrowing]—TypeScript's process of refining types to more specific types than originally declared. If you're not familiar with `assert`, you might want to take a look at its [API docs][debug-assert]! It's a development-and-test-only helper that gets stripped from production builds, and is very helpful for this kind of thing!

For example, let's pretend we're writing an addon that provides a `totalLength` helper to tally up the total length of an array of strings passed to it. Because addon authors cannot guarantee that their users will be using TypeScript, we've typed the positional arguments as an array of `unknown` so that TypeScript will ensure we've handled every possible valid or invalid argument a user might pass.

Expand Down
10 changes: 5 additions & 5 deletions guides/release/typescript/additional-resources/gotchas.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ This section covers the common details and "gotchas" of using TypeScript with Em

## Registries

Ember makes heavy use of string-based APIs to allow for a high degree of dynamicism. With some [limitations][get-set], you can nonetheless use TypeScript very effectively to get auto-complete/IntelliSense as well as to accurately type-check your applications by using **registries**.
Ember makes heavy use of string-based APIs to allow for a high degree of dynamicness. With some [limitations][get-set], you can nonetheless use TypeScript very effectively to get auto-complete/IntelliSense as well as to accurately type-check your applications by using **registries**.

Here's an example defining a Shopping Cart Service in the Ember Service registry:

Expand Down Expand Up @@ -60,7 +60,7 @@ For examples, see:

## Templates

Templates are currently totally non-type-checked. This means that you lose any safety when moving into a template context, even if using a Glimmer `Component` in Ember Octane. (Looking for type-checking in templates? Try [Glint]!)
Templates are currently totally non-type-checked. This means that you lose any safety when moving into a template context, even if using a Glimmer `Component` in Ember Octane. (Looking for type-checking in templates? Try [Glint][]!)

For example, TypeScript won't detect a mismatch between this action and the corresponding call in the template:

Expand All @@ -83,7 +83,7 @@ export default class MyGame extends Component {

## Hook Types and Autocomplete

Lets imagine a component which just logs the names of its arguments when it is first constructed. First, we must define the [Signature] and pass it into our component, then we can use the `Args` member in our Signature to set the type of `args` in the constructor:
Let's imagine a component which just logs the names of its arguments when it is first constructed. First, we must define the [Signature][] and pass it into our component, then we can use the `Args` member in our Signature to set the type of `args` in the constructor:

```typescript {data-filename="app/components/args-display.ts"}
import Component from '@glimmer/component';
Expand All @@ -106,9 +106,9 @@ export default class ArgsDisplay extends Component<ArgsDisplaySignature> {
}
```

Notice that we have to start by calling `super` with `owner` and `args`. This may be a bit different from what youre used to in Ember or other frameworks, but is normal for sub-classes in TypeScript today. If the compiler just accepted any `...arguments`, a lot of potentially _very_ unsafe invocations would go through. So, instead of using `...arguments`, we explicitly pass the _specific_ arguments and make sure their types match up with what the super-class expects.
Notice that we have to start by calling `super` with `owner` and `args`. This may be a bit different from what you're used to in Ember or other frameworks, but is normal for sub-classes in TypeScript today. If the compiler just accepted any `...arguments`, a lot of potentially _very_ unsafe invocations would go through. So, instead of using `...arguments`, we explicitly pass the _specific_ arguments and make sure their types match up with what the super-class expects.

The types for `owner` here and `args` line up with what the `constructor` for Glimmer components expects. The `owner` is specified as `unknown` because this is a detail we explicitly _dont_ need to know about. The `args` are the `Args` from the Signature we defined.
The types for `owner` here and `args` line up with what the `constructor` for Glimmer components expects. The `owner` is specified as `unknown` because this is a detail we explicitly _don't_ need to know about. The `args` are the `Args` from the Signature we defined.

Additionally, the types of the arguments passed to subclassed methods will _not_ autocomplete as you may expect. This is because in JavaScript, a subclass may legally override a superclass method to accept different arguments. Ember's lifecycle hooks, however, are called by the framework itself, and thus the arguments and return type should always match the superclass. Unfortunately, TypeScript does not and _cannot_ know that, so we have to provide the types directly.

Expand Down
2 changes: 1 addition & 1 deletion guides/release/typescript/additional-resources/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Here are some additional resources that should be useful for using Ember with Ty
- [Troubleshooting][gotchas] common issues when using TypeScript with Ember.
- [Frequently Asked Questions][faq] users have when using TypeScript with Ember.
- Miscellaneous [tips][faq] for using TypeScript with Ember.
- Looking for type-checking in Ember templates? Check out [Glint].
- Looking for type-checking in Ember templates? Check out [Glint][].

<!-- Internal links -->

Expand Down
Loading

0 comments on commit 3fefd39

Please sign in to comment.