build: npm and Deno workspace with core's gates
Same lint, format and complexity gates as core, plus a lint rule that keeps core a types-only import in plugin sources. Runtime suites are chosen from each package's engines, so declaring a runtime is what puts a package under its test. Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
This commit is contained in:
10 files changed
+3103
No files matched your search
@@ -0,0 +1,43 @@
|
||||
import js from '@eslint/js';
|
||||
import tseslint from 'typescript-eslint';
|
||||
import stylistic from '@stylistic/eslint-plugin';
|
||||
|
||||
export default tseslint.config(
|
||||
{ ignores: ['dist', 'node_modules', 'coverage'] },
|
||||
js.configs.recommended,
|
||||
...tseslint.configs.recommended,
|
||||
{
|
||||
plugins: { '@stylistic': stylistic },
|
||||
rules: {
|
||||
'@typescript-eslint/no-explicit-any': 'warn',
|
||||
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_', varsIgnorePattern: '^_' }],
|
||||
'@stylistic/padding-line-between-statements': [
|
||||
'error',
|
||||
{ blankLine: 'always', prev: 'multiline-block-like', next: '*' },
|
||||
{ blankLine: 'always', prev: '*', next: 'multiline-block-like' },
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
// Rule 8 of the convention. A value import of core makes the published plugin need core at
|
||||
// runtime, and no semver range accepts next month's CalVer beta — not even `*` — so every
|
||||
// install would warn. Tests are exempt: they drive the real createApp on purpose.
|
||||
files: ['packages/*/src/**/*.ts'],
|
||||
rules: {
|
||||
'no-restricted-imports': 'off',
|
||||
'@typescript-eslint/no-restricted-imports': [
|
||||
'error',
|
||||
{
|
||||
paths: [
|
||||
{
|
||||
name: '@green-tea/core',
|
||||
message: 'Plugins import core as types only: `import type { … } from "@green-tea/core"`.',
|
||||
allowTypeImports: true,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
'no-console': 'error',
|
||||
},
|
||||
},
|
||||
);
|
||||
Reference in new issue
Block a user