Skip to content

Commit

Permalink
Merge pull request #2 from desmosinc/tim/update-prettier-version
Browse files Browse the repository at this point in the history
Upgrade dependencies and remove deprecated prettier syntax
  • Loading branch information
timstallmann authored Jan 11, 2024
2 parents 3d58b00 + 55b6573 commit 2c79c85
Show file tree
Hide file tree
Showing 5 changed files with 375 additions and 361 deletions.
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

0 comments on commit 2c79c85

Please sign in to comment.