Skip to content

Commit

Permalink
Bump prettier from 2.8.8 to 3.0.0 (#8)
Browse files Browse the repository at this point in the history
* Bump prettier from 2.8.8 to 3.0.0

Bumps [prettier](https://github.com/prettier/prettier) from 2.8.8 to 3.0.0.
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md)
- [Commits](prettier/prettier@2.8.8...3.0.0)

---
updated-dependencies:
- dependency-name: prettier
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* fix tests

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Sigurd Fosseng <sigurd.fosseng@nrk.no>
  • Loading branch information
dependabot[bot] and laat authored Aug 2, 2023
1 parent ab01ef1 commit 336d4f8
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 31 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"assert-simple-tap": "^3.0.0",
"babel-core": "^6.26.3",
"npm-run-all": "^4.0.2",
"prettier": "^2.0.1"
"prettier": "^3.0.0"
},
"files": [
"lib"
Expand Down
54 changes: 24 additions & 30 deletions src/babel7.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import plugin from "./index";
const testGeneration = (message, code, expectedCode) => {
const transformedCode = babel.transform(code, {
babelrc: false,
plugins: [[plugin, { replacement: ".", original: "foobar" }]]
plugins: [[plugin, { replacement: ".", original: "foobar" }]],
}).code;
assert.equal(transformedCode.trim(), expectedCode.trim(), message);
};
Expand All @@ -17,7 +17,7 @@ import foo from "foobar";
`,
`
import foo from ".";
`
`,
);

testGeneration(
Expand All @@ -27,7 +27,7 @@ import * as foo from "foobar";
`,
`
import * as foo from ".";
`
`,
);

testGeneration(
Expand All @@ -37,7 +37,7 @@ import { foo } from "foobar";
`,
`
import { foo } from ".";
`
`,
);

testGeneration(
Expand All @@ -47,7 +47,7 @@ import { default as foobar } from "foobar";
`,
`
import { default as foobar } from ".";
`
`,
);

testGeneration(
Expand All @@ -57,7 +57,7 @@ require("foobar")
`,
`
require(".");
`
`,
);

testGeneration(
Expand All @@ -67,7 +67,7 @@ require("foobar/file");
`,
`
require("./file");
`
`,
);

testGeneration(
Expand All @@ -77,7 +77,7 @@ import foo from "foobar/file";
`,
`
import foo from "./file";
`
`,
);

testGeneration(
Expand All @@ -87,7 +87,7 @@ export { something } from "foobar";
`,
`
export { something } from ".";
`
`,
);

const testMultipleReplacements = (message, code, expectedCode) => {
Expand All @@ -99,11 +99,11 @@ const testMultipleReplacements = (message, code, expectedCode) => {
{
replacements: [
{ replacement: ".", original: "foobar" },
{ replacement: "baz", original: "bar" }
]
}
]
]
{ replacement: "baz", original: "bar" },
],
},
],
],
}).code;
assert.equal(transformedCode.trim(), expectedCode.trim(), message);
};
Expand All @@ -112,14 +112,12 @@ testMultipleReplacements(
"support importing of files within a module",
`
import foo from "bar";
require("foobar");
`,
`
import foo from "baz";
require(".");
`
`,
);

const testMultipleReplacementsBabel7 = (message, code, expectedCode) => {
Expand All @@ -131,11 +129,11 @@ const testMultipleReplacementsBabel7 = (message, code, expectedCode) => {
{
replacements: [
{ replacement: ".", original: "foobar" },
{ replacement: "baz", original: "bar" }
]
}
]
]
{ replacement: "baz", original: "bar" },
],
},
],
],
}).code;
assert.equal(transformedCode.trim(), expectedCode.trim(), message);
};
Expand All @@ -144,20 +142,18 @@ testMultipleReplacementsBabel7(
"support importing of files within a module",
`
import foo from "bar";
require("foobar");
`,
`
import foo from "baz";
require(".");
`
`,
);

const testRegexp = (message, { original, replacement }, code, expectedCode) => {
const transformedCode = babel.transform(code, {
babelrc: false,
plugins: [[plugin, { replacements: [{ replacement, original }] }]]
plugins: [[plugin, { replacements: [{ replacement, original }] }]],
}).code;
assert.equal(transformedCode.trim(), expectedCode.trim(), message);
};
Expand All @@ -166,16 +162,14 @@ testRegexp(
"replaces with RegExp",
{
original: "^(.+?)\\.less$",
replacement: "$1.css"
replacement: "$1.css",
},
`
import css1 from "./foo.less";
const css2 = require("../bar.less");
`,
`
import css1 from "./foo.css";
const css2 = require("../bar.css");
`
`,
);

0 comments on commit 336d4f8

Please sign in to comment.