diff --git a/.prettierignore b/.prettierignore index ac481a74096..ca079d4c43b 100644 --- a/.prettierignore +++ b/.prettierignore @@ -26,3 +26,4 @@ tmp/ **/*.json !**/tsconfig.json **/*.md +**/*.d.ts diff --git a/bin/lint b/bin/lint index fab35810ae9..277b0fd4f42 100755 --- a/bin/lint +++ b/bin/lint @@ -12,8 +12,8 @@ PROJECT_ROOT = File.expand_path("..", __dir__) # live outside the core repo (e.g. plugins/*) where lefthook is not available. class ExternalLinter RUBY_EXTENSIONS = %w[rb rake thor].freeze - PRETTIER_EXTENSIONS = %w[css scss js gjs cjs mjs].freeze - ESLINT_EXTENSIONS = %w[js gjs].freeze + PRETTIER_EXTENSIONS = %w[css scss js gjs cjs mjs ts gts mts cts].freeze + ESLINT_EXTENSIONS = %w[js gjs ts gts mts cts].freeze STYLELINT_EXTENSIONS = %w[scss].freeze JS_EXTENSIONS = (PRETTIER_EXTENSIONS + ESLINT_EXTENSIONS + STYLELINT_EXTENSIONS).uniq.freeze @@ -239,7 +239,7 @@ class LefthookLinter end # Check if file extension is lintable - lintable_extensions = %w[rb rake js gjs hbs scss css yml yaml thor] + lintable_extensions = %w[rb rake js gjs ts gts mts cts hbs scss css yml yaml thor] lintable_extensions.include?(ext) end diff --git a/docs/developer-guides/docs/03-code-internals/26-types.md b/docs/developer-guides/docs/03-code-internals/26-types.md index d79213840ae..c3c241f3348 100644 --- a/docs/developer-guides/docs/03-code-internals/26-types.md +++ b/docs/developer-guides/docs/03-code-internals/26-types.md @@ -8,6 +8,10 @@ Discourse ships type information for its JavaScript code. This can provide inlin Much of this will be automatically consumed by IDEs with TypeScript/JavaScript support. But for functionality in `.gjs` files, you'll need some specific configuration and/or IDE plugins. +## Writing TypeScript + +Core, themes and plugins can be authored directly in TypeScript. Use a `.ts` extension for plain modules, or `.gts` for Glimmer components with a `