Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade dependencies and remove deprecated prettier syntax #2

Merged
merged 2 commits into from
Jan 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:

strategy:
matrix:
node-version: [12.x]
node-version: [18.x]

steps:
- uses: actions/checkout@v2
Expand Down
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@
"author": "",
"license": "ISC",
"dependencies": {
"@fluent/syntax": "^0.16.0",
"@types/prettier": "^2.1.0",
"typescript": "3.7.5"
"@fluent/syntax": "^0.19.0",
"@types/prettier": "^3",
"typescript": "^5.3.3"
},
"devDependencies": {
"@types/mocha": "^7.0.2",
"@types/node": "^14.0.1",
"mocha": "^7.1.2",
"@types/mocha": "^10",
"@types/node": "^18",
"mocha": "^10.0.0",
"npm-run-all": "^4.1.5",
"prettier": "^2.0.5"
"prettier": "^3.x"
}
}
9 changes: 5 additions & 4 deletions src/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import * as prettier from 'prettier';
import * as assert from 'assert';
import * as prettierPluginFluent from './index';

describe('prettier-plugin-fluent', () => {
it('alphabetizes entries', () => {
it('alphabetizes entries', async () => {
const code = `
b = Beluga
bad syntax stays with subsequent entry
Expand All @@ -11,9 +12,9 @@ a = Abe {$x}
bad syntax at end is preserved
`;

const pretty = prettier.format(code, {
const pretty = await prettier.format(code, {
parser: 'fluent-parse' as any,
plugins: ['.'],
plugins: [prettierPluginFluent],
});

assert.equal(
Expand All @@ -24,7 +25,7 @@ bad syntax stays with subsequent entry
a = Abe { $x }
b = Beluga
bad syntax at end is preserved
`.trim()
`.trim(),
);
});
});
7 changes: 3 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import * as prettier from 'prettier';
import * as FTL from '@fluent/syntax';

// A prettier plugin that alphabetizes the entries in an Fluent file

const plugin: prettier.Plugin = {
languages: [
{
Expand Down Expand Up @@ -36,11 +35,11 @@ const plugin: prettier.Plugin = {
printers: {
'fluent-ast': {
print(
path: prettier.FastPath,
path: prettier.AstPath,
_options: prettier.ParserOptions,
_print: (path: prettier.FastPath) => prettier.Doc
_print: (path: prettier.AstPath) => prettier.Doc,
): prettier.Doc {
const node: FTL.Resource = path.getValue();
const node: FTL.Resource = path.node;

const entries: {
id: string;
Expand Down
Loading
Loading