Skip to content

Commit

Permalink
feat: add missing http grammar
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Dec 21, 2023
1 parent 323b88c commit 6d805bf
Show file tree
Hide file tree
Showing 9 changed files with 139 additions and 162 deletions.
16 changes: 15 additions & 1 deletion eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,29 @@
// @ts-check
import antfu from '@antfu/eslint-config'

const keysOrders = [
'name',
'displayName',
'aliases',
'source',
'marketplace',
'embeddedIn',
'injectTo',
]

export default antfu(
{
ignores: [
'packages/tm-grammars/grammars/**',
],
},
{
files: ['sources-grammars.ts', 'sources-themes.ts'],
rules: {
// overrides
'perfectionist/sort-objects': ['error', {
'groups': keysOrders,
'custom-groups': Object.fromEntries(keysOrders.map(key => [key, [key]])),
}],
},
},
)
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"dotenv": "^16.3.1",
"eslint": "^8.55.0",
"esno": "^4.0.0",
"fast-glob": "^3.3.2",
"fast-plist": "^0.1.3",
"js-yaml": "^4.1.0",
"json-stable-stringify": "^1.1.0",
Expand Down
13 changes: 8 additions & 5 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

77 changes: 0 additions & 77 deletions samples/dm.sample

This file was deleted.

7 changes: 7 additions & 0 deletions samples/glimmer-ts.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import type { TemplateOnlyComponent } from '@glimmer/component';

const Greet: TemplateOnlyComponent<{ name: string }> = <template>
<p>Hello, {{@name}}!</p>
</template>

# From https://rfcs.emberjs.com/id/0779-first-class-component-templates
File renamed without changes.
24 changes: 24 additions & 0 deletions scripts/check.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { basename } from 'node:path'
import fg from 'fast-glob'

export async function checkSamples() {
const samples = await fg('samples/*.sample', {
onlyFiles: true,
}).then(r => r.map(f => basename(f).replace(/\.sample$/, '')))

const grammars = await import('../packages/tm-grammars/index.js')
.then(m => m.grammars.map(i => i.name))

const allGrammars = await import('../packages/tm-grammars/index.js')
.then(m => m.grammars.flatMap(i => [i.name, ...i.aliases || []]))

const missingSamples = grammars.filter(g => !samples.includes(g))
const extraSamples = samples.filter(s => !allGrammars.includes(s))

console.log({
missingSamples,
extraSamples,
})
}

await checkSamples()
Loading

0 comments on commit 6d805bf

Please sign in to comment.