Skip to content

Commit 0d85fbd

Browse files
Merge pull request #38 from JoshuaKGoldberg/bump-dev-dependencies-may-2023
build: re-run build to refresh dist/dedent.js
2 parents 30e5151 + 1abd407 commit 0d85fbd

7 files changed

Lines changed: 3025 additions & 2785 deletions

File tree

.babelrc

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
11
{
2-
"presets": [
3-
"es2015",
4-
"es2016",
5-
"es2017"
6-
],
7-
"plugins": [
8-
"transform-flow-strip-types"
9-
]
2+
"presets": ["@babel/preset-env"],
3+
"plugins": ["transform-flow-strip-types"]
104
}

.eslintrc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,12 @@
44
"node": true,
55
"es6": true
66
},
7-
"parser": "babel-eslint",
7+
"parser": "hermes-eslint",
88
"parserOptions": {
99
"sourceType": "module"
1010
},
11-
"extends": "eslint:recommended",
11+
"plugins": ["ft-flow"],
12+
"extends": ["eslint:recommended", "plugin:ft-flow/recommended"],
1213
"rules": {
1314
"semi": [2, "always"],
1415
"curly": [2, "multi-line"]
Lines changed: 43 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,76 +1,88 @@
1-
exports[`as a function 1`] = `
2-
"
3-
import dedent from \"../macro\";
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`macros 1. as a function: 1. as a function 1`] = `
4+
5+
6+
import dedent from "../macro";
47
58
dedent(\`
69
some stuff
710
\`);
11+
812
913
↓ ↓ ↓ ↓ ↓ ↓
1014
11-
\"some stuff\";
12-
"
15+
"some stuff";
16+
1317
`;
1418

15-
exports[`as a template string 1`] = `
16-
"
17-
import dedent from \"../macro\";
19+
exports[`macros 2. as a template string: 2. as a template string 1`] = `
20+
21+
22+
import dedent from "../macro";
1823
1924
dedent\`
2025
some stuff
2126
\`;
27+
2228
2329
↓ ↓ ↓ ↓ ↓ ↓
2430
25-
\"some stuff\";
26-
"
31+
"some stuff";
32+
2733
`;
2834

29-
exports[`explicit newline 1`] = `
30-
"
31-
import dedent from \"../macro\";
35+
exports[`macros 3. explicit newline: 3. explicit newline 1`] = `
36+
37+
38+
import dedent from "../macro";
3239
3340
dedent\`
3441
<p>
3542
Hello world!
3643
</p>
3744
3845
\`;
46+
3947
4048
↓ ↓ ↓ ↓ ↓ ↓
4149
42-
\"<p>\\n Hello world!\\n</p>\";
43-
"
50+
"<p>\\n Hello world!\\n</p>";
51+
4452
`;
4553

46-
exports[`expressions 1`] = `
47-
"
48-
import dedent from \"../macro\";
54+
exports[`macros 4. multiple indentations: 4. multiple indentations 1`] = `
55+
56+
57+
import dedent from "../macro";
4958
5059
dedent\`
51-
first line
52-
second
53-
third
60+
first
61+
second
62+
third
5463
\`;
64+
5565
5666
↓ ↓ ↓ ↓ ↓ ↓
5767
58-
\"first line\\n second\\n third\";
59-
"
68+
"first\\n second\\n third";
69+
6070
`;
6171

62-
exports[`multiple indentations 1`] = `
63-
"
64-
import dedent from \"../macro\";
72+
exports[`macros 5. expressions: 5. expressions 1`] = `
73+
74+
75+
import dedent from "../macro";
6576
6677
dedent\`
67-
first
68-
second
69-
third
78+
first line
79+
second
80+
third
7081
\`;
82+
7183
7284
↓ ↓ ↓ ↓ ↓ ↓
7385
74-
\"first\\n second\\n third\";
75-
"
86+
"first line\\n second\\n third";
87+
7688
`;

__tests__/__snapshots__/dedent-tests.js.snap

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
13
exports[`dedent can be used as a function 1`] = `"A test argument."`;
24

35
exports[`dedent doesn't strip exlicit newlines 1`] = `
@@ -24,7 +26,7 @@ exports[`dedent works with blank first line 1`] = `
2426
"Some text that I might want to indent:
2527
* reasons
2628
* fun
27-
That\'s all."
29+
That's all."
2830
`;
2931

3032
exports[`dedent works with escaped tabs for indentation 1`] = `

dist/dedent.js

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Object.defineProperty(exports, "__esModule", {
44
value: true
55
});
6-
exports.default = dedent;
6+
exports["default"] = dedent;
77
function dedent(strings) {
88
// $FlowFixMe: Flow doesn't undestand .raw
99
var raw = typeof strings === "string" ? [strings] : strings.raw;
@@ -16,9 +16,8 @@ function dedent(strings) {
1616
.replace(/\\\n[ \t]*/g, "")
1717
// handle escaped backticks
1818
.replace(/\\`/g, "`");
19-
2019
if (i < (arguments.length <= 1 ? 0 : arguments.length - 1)) {
21-
result += arguments.length <= i + 1 ? undefined : arguments[i + 1];
20+
result += i + 1 < 1 || arguments.length <= i + 1 ? undefined : arguments[i + 1];
2221
}
2322
}
2423

@@ -37,16 +36,12 @@ function dedent(strings) {
3736
}
3837
}
3938
});
40-
4139
if (mindent !== null) {
42-
(function () {
43-
var m = mindent; // appease Flow
44-
result = lines.map(function (l) {
45-
return l[0] === " " || l[0] === "\t" ? l.slice(m) : l;
46-
}).join("\n");
47-
})();
40+
var m = mindent; // appease Flow
41+
result = lines.map(function (l) {
42+
return l[0] === " " || l[0] === "\t" ? l.slice(m) : l;
43+
}).join("\n");
4844
}
49-
5045
return result
5146
// dedent eats leading and trailing whitespace too
5247
.trim()

package.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,17 @@
2828
},
2929
"homepage": "https://github.com/dmnd/dedent",
3030
"devDependencies": {
31-
"babel-cli": "^6.22.2",
32-
"babel-eslint": "^7.1.1",
33-
"babel-plugin-macros": "^2.0.0",
31+
"@babel/cli": "^7.21.5",
32+
"@babel/core": "^7.21.8",
33+
"@babel/preset-env": "^7.21.5",
34+
"babel-plugin-macros": "^3.1.0",
35+
"babel-plugin-tester": "^11.0.4",
3436
"babel-plugin-transform-flow-strip-types": "^6.22.0",
35-
"babel-plugin-tester": "^5.0.0",
36-
"babel-preset-es2015": "^6.22.0",
37-
"babel-preset-es2016": "^6.22.0",
38-
"babel-preset-es2017": "^6.22.0",
39-
"eslint": "^3.14.1",
40-
"flow-bin": "^0.38.0",
41-
"jest": "^18.1.0"
37+
"eslint-plugin-ft-flow": "^2.0.3",
38+
"eslint": "^8.41.0",
39+
"flow-bin": "^0.206.0",
40+
"hermes-eslint": "^0.11.1",
41+
"jest": "^29.5.0"
4242
},
4343
"scripts": {
4444
"build": "babel dedent.js --out-file dist/dedent.js",

0 commit comments

Comments
 (0)