Skip to content

Commit

Permalink
So much to change from upstream
Browse files Browse the repository at this point in the history
  • Loading branch information
NullVoxPopuli committed Sep 23, 2024
1 parent c905078 commit 28e657f
Show file tree
Hide file tree
Showing 6 changed files with 238 additions and 1 deletion.
98 changes: 98 additions & 0 deletions files-override/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
'use strict';

module.exports = {
overrides: [
{
files: ['*.{js,ts,mjs,cjs}'],
plugins: ['ember'],
parser: '@typescript-eslint/parser',
extends: ['eslint:recommended', 'plugin:ember/recommended'],
},
{
files: ['*.gts'],
parser: 'ember-eslint-parser',
plugins: ['ember'],
extends: [
'eslint:recommended',
'plugin:ember/recommended',
'plugin:ember/recommended-gts',
],
},
{
files: ['*.gjs'],
parser: 'ember-eslint-parser',
plugins: ['ember'],
extends: [
'eslint:recommended',
'plugin:ember/recommended',
'plugin:ember/recommended-gjs',
],
},
// test files
{
files: ['tests/**/*-test.{js,ts}'],
plugins: ['ember'],
parser: '@typescript-eslint/parser',
extends: ['eslint:recommended', 'plugin:qunit/recommended'],
},
{
files: ['tests/**/*-test.{gjs,gts}'],
parser: 'ember-eslint-parser',
plugins: ['ember'],
extends: [
'eslint:recommended',
'plugin:ember/recommended',
'plugin:ember/recommended-gts',
],
},
{
files: ['*.gts', '*.ts'],
plugins: ['no-relative-import-paths'],
settings: {
node: {
tryExtensions: ['.gts', '.ts', '.js', '.module.css', '.css'],
},
},
rules: {
'no-relative-import-paths/no-relative-import-paths': [
'warn',
{ allowSameFolder: true, rootDir: 'app', prefix: 'discord-clone' },
],
'n/file-extension-in-import': [
'error',
'always',
{
'.css': 'always',
'.module.css': 'always',
'.gts': 'never',
'.ts': 'never',
'.js': 'never',
},
],
},
},

// node files
{
files: [
'./.eslintrc.{js,cjs}',
'./.prettierrc.{js,cjs}',
'./.stylelintrc.{js,cjs}',
'./.template-lintrc.{js,cjs}',
'./ember-cli-build.js',
'./testem.js',
'./blueprints/*/index.js',
'./config/**/*.js',
'./lib/*/index.js',
'./server/**/*.js',
'*.mjs',
'*.cjs',
],
env: {
browser: false,
node: true,
},
extends: ['plugin:n/recommended'],
},
],
};
34 changes: 34 additions & 0 deletions files-override/.prettierrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
'use strict';

module.exports = {
plugins: ['prettier-plugin-ember-template-tag'],
overrides: [
{
files: ['*.js', '*.ts', '*.cjs', '.mjs', '.cts', '.mts', '.cts'],
options: {
singleQuote: true,
trailingComma: 'es5',
},
},
{
files: ['*.json'],
options: {
singleQuote: false,
},
},
{
files: ['*.hbs'],
options: {
singleQuote: false,
},
},
{
files: ['*.gjs', '*.gts'],
options: {
singleQuote: true,
templateSingleQuote: false,
trailingComma: 'es5',
},
},
],
};
File renamed without changes.
46 changes: 46 additions & 0 deletions files-override/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"extends": "@tsconfig/ember/tsconfig.json",
"include": [
"app/**/*",
"tests/**/*",
],
"glint": {
"environment": [
"ember-loose",
"ember-template-imports"
]
},
"compilerOptions": {
"allowJs": true,
/**
https://www.typescriptlang.org/tsconfig#noEmitOnError
Do not block emit on TS errors.
*/
"noEmitOnError": false,

"declaration": false,
"declarationMap": false,

/**
https://www.typescriptlang.org/tsconfig#allowImportingTsExtensions
We want our tooling to know how to resolve our custom files so the appropriate plugins
can do the proper transformations on those files.
*/
"allowImportingTsExtensions": true,
"paths": {
"<%= name %./tests/*": [
"./tests/*"
],
"<%= naem %./*": [
"./app/*"
],
"*": [
"./types/*"
]
},
"types": [
"ember-source/types"
]
},
}
8 changes: 8 additions & 0 deletions files/babel.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ const {

module.exports = {
plugins: [
[
'@babel/plugin-transform-typescript',
{
allExtensions: true,
onlyRemoveTypeImports: true,
allowDeclareFields: true,
},
],
[
'babel-plugin-ember-template-compilation',
{
Expand Down
53 changes: 52 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,29 @@ module.exports = {
'vite',
'@rollup/plugin-babel',
'decorator-transforms',

// Dependencies out of date from upstream
'@ember/string',
'ember-resolver',
'eslint-plugin-ember',
'ember-template-lint',
'qunit-dom',
'stylelint',
'stylelint-prettier',
'stylelint-config-standard',
'concurrently',
'prettier-plugin-ember-template-tag',

// TypeScript
// Note that Vite supports TypeScript with 0 configuration on the user's part
'@babel/plugin-transform-typescript',
'typescript',
'@glint/core',
'@glint/environment-ember-loose', // currently required :(
'@glint/environment-ember-template-imports',
'@glint/template',
'@typescript-eslint/eslint-plugin',
'@typescript-eslint/parser',
],
packageManager: options.packageManager,
});
Expand All @@ -50,6 +73,34 @@ module.exports = {
'ember-cli-dependency-checker',
'ember-cli-sri',
'ember-cli-terser',

// Upstream TypeScript blueprint is too conservative
// at the same time, ember-data has been what's holding it back
'@types/ember-data',
'@types/ember-data__adapter',
'@types/ember-data__model',
'@types/ember-data__serializer',
'@types/ember-data__store',
'@types/ember__application',
'@types/ember__array',
'@types/ember__component',
'@types/ember__controller',
'@types/ember__debug',
'@types/ember__destroyable',
'@types/ember__engine',
'@types/ember__error',
'@types/ember__helper',
'@types/ember__modifier',
'@types/ember__object',
'@types/ember__owner',
'@types/ember__polyfills',
'@types/ember__routing',
'@types/ember__runloop',
'@types/ember__service',
'@types/ember__string',
'@types/ember__template',
'@types/ember__test',
'@types/ember__utils',
];

for (const package of packages) {
Expand All @@ -67,7 +118,7 @@ module.exports = {
},

async afterInstall(options) {
const filesToDelete = ['app/index.html'];
const filesToDelete = ['app/index.html', '.eslintrc.js', '.prettierrc.js'];

for (let file of filesToDelete) {
await rm(join(options.target, file));
Expand Down

0 comments on commit 28e657f

Please sign in to comment.