-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add new build-config package (#9292)
* feat: build config * fixup * fixup * dont change * fix types * fixup lint * prep work for v1 downlevel * downlevel addons to v1 * fixup * fixes * try again? * fixup again * another attempt * add uplevel script * cleanup * remove accidental files * downlevel more * again? * try more * fix uplevel * fix * fixup * fix more tests?
- Loading branch information
Showing
759 changed files
with
13,553 additions
and
13,235 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,7 +60,6 @@ | |
{ | ||
"matchPackageNames": [ | ||
"chai", | ||
"mocha", | ||
"qunit-dom", | ||
"sinon", | ||
"ember-exam", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
module.exports = function () { | ||
const addonLocation = process.env.ADDON_LOCATION; | ||
const pkgPath = addonLocation + '/package.json'; | ||
const pkg = require(pkgPath); | ||
const isV1Addon = !pkg['ember-addon'] || pkg['ember-addon'].version === 1; | ||
|
||
function replaceExt(node) { | ||
if (node.value.endsWith('.mjs')) { | ||
node.value = node.value.replace('.mjs', '.js'); | ||
} | ||
if (isV1Addon) { | ||
if (node.value.endsWith('.js')) { | ||
node.value = node.value.replace('.js', ''); | ||
} | ||
} | ||
} | ||
|
||
return { | ||
name: '@warp-drive/internal-config/fix-mjs', | ||
visitor: { | ||
Program(path) { | ||
path.node.body.forEach((node) => { | ||
if (node.type === 'ImportDeclaration' || (node.type === 'ExportNamedDeclaration' && node.source)) { | ||
replaceExt(node.source); | ||
} | ||
}); | ||
}, | ||
CallExpression(path) { | ||
if (path.node.callee.type === 'Import') { | ||
replaceExt(path.node.arguments[0]); | ||
} | ||
}, | ||
}, | ||
}; | ||
}; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// @ts-check | ||
import js from '@eslint/js'; | ||
import prettier from 'eslint-config-prettier'; | ||
import * as imports from './imports.js'; | ||
import * as isolation from './isolation.js'; | ||
import * as ts from './typescript.js'; | ||
|
||
// function resolve(name) { | ||
// const fullPath = import.meta.resolve(name); | ||
// if (fullPath.startsWith('file://')) { | ||
// return fullPath.slice(7); | ||
// } | ||
// } | ||
|
||
export function rules(config = {}) { | ||
const ourRules = { | ||
eqeqeq: 'error', | ||
'new-cap': ['error', { capIsNew: false }], | ||
'no-caller': 'error', | ||
'no-cond-assign': ['error', 'except-parens'], | ||
'no-console': 'error', // no longer recommended in eslint v6, this restores it | ||
'no-eq-null': 'error', | ||
'no-eval': 'error', | ||
'no-unused-vars': ['error', { args: 'none' }], | ||
|
||
// Too many false positives | ||
// See https://github.com/eslint/eslint/issues/11899 and similar | ||
'require-atomic-updates': 'off', | ||
|
||
'prefer-rest-params': 'off', | ||
'prefer-const': 'error', | ||
}; | ||
|
||
return Object.assign( | ||
{}, | ||
js.configs.recommended.rules, | ||
prettier.rules, | ||
imports.rules(), | ||
isolation.rules(config), | ||
ourRules | ||
); | ||
} | ||
|
||
/** @returns {import('eslint').Linter.FlatConfig} */ | ||
export function browser(config = {}) { | ||
config.files = Array.isArray(config.files) ? config.files : ['**/*.{js,gjs}']; | ||
const base = ts.browser(config); | ||
// @ts-expect-error | ||
base.languageOptions.parserOptions.project = null; | ||
base.rules = rules(config); | ||
base.plugins = imports.plugins(); | ||
|
||
return base; | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import * as isolation from './isolation.js'; | ||
import * as qunit from './qunit.js'; | ||
|
||
const QUNIT_BANNED_IMPORTS = ['ember-qunit', 'qunit', 'ember-exam']; | ||
|
||
/** @returns {import('eslint').Linter.FlatConfig} */ | ||
export function browser(config = {}) { | ||
const base = qunit.ember(config); | ||
base.rules = Object.assign( | ||
base.rules, | ||
{ | ||
'qunit/no-assert-equal': 'off', | ||
}, | ||
isolation.rules({ | ||
allowedImports: ['@ember/test-helpers', '@ember/test-waiters', ...(config.allowedImports ?? [])].filter( | ||
(v) => !QUNIT_BANNED_IMPORTS.includes(v) | ||
), | ||
}), | ||
config.rules ?? {} | ||
); | ||
|
||
return base; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import noop from 'ember-eslint-parser/noop'; | ||
import emberEslintParser from 'ember-eslint-parser'; | ||
import * as ts from './typescript.js'; | ||
|
||
export function browser(config) { | ||
config.files = config.files ?? ['**/*.{gts,gjs}']; | ||
const base = ts.browser(config); | ||
|
||
const parser = Object.assign( | ||
{ | ||
meta: { | ||
name: 'ember-eslint-parser', | ||
version: '*', | ||
}, | ||
}, | ||
emberEslintParser | ||
); | ||
|
||
base.languageOptions.parser = parser; | ||
base.processor = 'ember/noop'; | ||
base.plugins = Object.assign({}, base.plugins, { | ||
ember: { | ||
meta: { | ||
name: 'ember', | ||
version: '*', | ||
}, | ||
processors: { | ||
noop, | ||
}, | ||
}, | ||
}); | ||
|
||
return base; | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.