Skip to content

Commit bf3b0c8

Browse files
author
ci-bot
committed
prettier version update
1 parent bf022dd commit bf3b0c8

File tree

6 files changed

+51
-103
lines changed

6 files changed

+51
-103
lines changed

apps/remix-ide-e2e/src/tests/code_format.test.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,21 +80,17 @@ proposalNames.push(bytes32("candidate1"));
8080
}`
8181

8282
const formattedContract = `pragma solidity >=0.4.22 <0.9.0;
83-
8483
contract unfomattedContract {
8584
bytes32[] proposalNames;
86-
8785
function beforeAll() public {
8886
proposalNames.push(bytes32("candidate1"));
8987
ballotToTest = new Ballot(proposalNames);
9088
}
9189
}`
9290

9391
const formattedWithTabWidth2 = `pragma solidity >=0.4.22 <0.9.0;
94-
9592
contract unfomattedContract {
9693
bytes32[] proposalNames;
97-
9894
function beforeAll() public {
9995
proposalNames.push(bytes32("candidate1"));
10096
ballotToTest = new Ballot(proposalNames);

apps/remix-ide/src/app/plugins/code-format.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
'use strict'
22
import { Plugin } from '@remixproject/engine'
3-
import { Options } from 'prettier';
4-
import sol from './code-format/index'
3+
import { Options } from 'prettier'
54
import path from 'path'
65
import yaml from 'js-yaml'
76
import toml from 'toml'
@@ -82,6 +81,7 @@ export class CodeFormat extends Plugin {
8281
this.babel = await import('prettier/parser-babel')
8382
this.espree = await import('prettier/parser-espree')
8483
this.yml = await import('prettier/parser-yaml')
84+
this.sol = (await import('prettier-plugin-solidity')).default
8585
}
8686

8787
try {
@@ -92,7 +92,7 @@ export class CodeFormat extends Plugin {
9292
}
9393
switch (path.extname(file)) {
9494
case '.sol':
95-
parserName = 'solidity-parse'
95+
parserName = 'slang'
9696
break
9797
case '.ts':
9898
parserName = 'typescript'
@@ -231,7 +231,7 @@ export class CodeFormat extends Plugin {
231231
}
232232
}
233233
})
234-
const validParsers = ['typescript', 'babel', 'espree', 'solidity-parse', 'json', 'yaml', 'solidity-parse']
234+
const validParsers = ['typescript', 'babel', 'espree', 'json', 'yaml', 'slang']
235235
if (override && override.options && override.options.parser) {
236236
if (validParsers.includes(override.options.parser)) {
237237
parserName = override.options.parser
@@ -249,8 +249,8 @@ export class CodeFormat extends Plugin {
249249
}
250250
}
251251

252-
const result = this.prettier.format(content, {
253-
plugins: [sol as any, this.ts, this.babel, this.espree, this.yml],
252+
const result = await this.prettier.format(content, {
253+
plugins: [this.sol, this.ts, this.babel, this.espree, this.yml],
254254
parser: parserName,
255255
...options
256256
})
@@ -260,6 +260,7 @@ export class CodeFormat extends Plugin {
260260
return result
261261
} catch (e) {
262262
// do nothing
263+
console.error(e)
263264
}
264265
}
265266

apps/remix-ide/src/app/plugins/code-format/index.ts

Lines changed: 0 additions & 61 deletions
This file was deleted.

apps/remix-ide/webpack.config.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,10 @@ module.exports = composePlugins(withNx(), withReact(), (config) => {
137137
})
138138
)
139139

140+
config.plugins.push(
141+
new webpack.IgnorePlugin({ resourceRegExp: /^node:/ })
142+
)
143+
140144
// source-map loader
141145
config.module.rules.push({
142146
test: /\.js$/,

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,8 @@
182182
"octokit": "^3.1.2",
183183
"path-browserify": "^1.0.1",
184184
"permissionless": "0.2.25",
185-
"prettier": "^2.8.4",
186-
"prettier-plugin-solidity": "^1.0.0-beta.24",
185+
"prettier": "^3.6.2",
186+
"prettier-plugin-solidity": "^2.1.0",
187187
"ra-data-graphql": "^4.16.11",
188188
"raw-loader": "^4.0.2",
189189
"react": "^18.2.0",
@@ -216,6 +216,7 @@
216216
"signale": "^1.4.0",
217217
"snarkjs": "^0.7.0",
218218
"sol2uml": "^2.4.3",
219+
"solidity-comments-extractor": "^0.0.8",
219220
"string-similarity": "^4.0.4",
220221
"svg2pdf.js": "^2.2.1",
221222
"text-encoding": "^0.7.0",

yarn.lock

Lines changed: 37 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2234,6 +2234,11 @@
22342234
resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39"
22352235
integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==
22362236

2237+
"@bytecodealliance/preview2-shim@0.17.2":
2238+
version "0.17.2"
2239+
resolved "https://registry.yarnpkg.com/@bytecodealliance/preview2-shim/-/preview2-shim-0.17.2.tgz#8d0c732cba29169a85aa3e603c767e039378f89b"
2240+
integrity sha512-mNm/lblgES8UkVle8rGImXOz4TtL3eU3inHay/7TVchkKrb/lgcVvTK0+VAw8p5zQ0rgQsXm1j5dOlAAd+MeoA==
2241+
22372242
"@chainsafe/as-sha256@^0.3.1":
22382243
version "0.3.1"
22392244
resolved "https://registry.yarnpkg.com/@chainsafe/as-sha256/-/as-sha256-0.3.1.tgz#3639df0e1435cab03f4d9870cc3ac079e57a6fc9"
@@ -5469,6 +5474,13 @@
54695474
mcl-wasm "^0.7.1"
54705475
rustbn.js "~0.2.0"
54715476

5477+
"@nomicfoundation/slang@1.2.0":
5478+
version "1.2.0"
5479+
resolved "https://registry.yarnpkg.com/@nomicfoundation/slang/-/slang-1.2.0.tgz#38a389729bf2bc882b75e3feada9995bedc50091"
5480+
integrity sha512-+04Z1RHbbz0ldDbHKQFOzveCdI9Rd3TZZu7fno5hHy3OsqTo9UK5Jgqo68wMvRovCO99POv6oCEyO7+urGeN8Q==
5481+
dependencies:
5482+
"@bytecodealliance/preview2-shim" "0.17.2"
5483+
54725484
"@nomicfoundation/solidity-analyzer-darwin-arm64@0.1.0":
54735485
version "0.1.0"
54745486
resolved "https://registry.yarnpkg.com/@nomicfoundation/solidity-analyzer-darwin-arm64/-/solidity-analyzer-darwin-arm64-0.1.0.tgz#83a7367342bd053a76d04bbcf4f373fef07cf760"
@@ -7027,20 +7039,18 @@
70277039
dependencies:
70287040
"@sinonjs/commons" "^1.7.0"
70297041

7030-
"@solidity-parser/parser@^0.14.3":
7031-
version "0.14.3"
7032-
resolved "https://registry.yarnpkg.com/@solidity-parser/parser/-/parser-0.14.3.tgz#0d627427b35a40d8521aaa933cc3df7d07bfa36f"
7033-
integrity sha512-29g2SZ29HtsqA58pLCtopI1P/cPy5/UAzlcAXO6T/CNJimG6yA8kx4NaseMyJULiC+TEs02Y9/yeHzClqoA0hw==
7034-
dependencies:
7035-
antlr4ts "^0.5.0-alpha.4"
7036-
70377042
"@solidity-parser/parser@^0.14.5":
70387043
version "0.14.5"
70397044
resolved "https://registry.yarnpkg.com/@solidity-parser/parser/-/parser-0.14.5.tgz#87bc3cc7b068e08195c219c91cd8ddff5ef1a804"
70407045
integrity sha512-6dKnHZn7fg/iQATVEzqyUOyEidbn05q7YA2mQ9hC0MMXhhV3/JrsxmFSYZAcr7j1yUP700LLhTruvJ3MiQmjJg==
70417046
dependencies:
70427047
antlr4ts "^0.5.0-alpha.4"
70437048

7049+
"@solidity-parser/parser@^0.20.1":
7050+
version "0.20.2"
7051+
resolved "https://registry.yarnpkg.com/@solidity-parser/parser/-/parser-0.20.2.tgz#e07053488ed60dae1b54f6fe37bb6d2c5fe146a7"
7052+
integrity sha512-rbu0bzwNvMcwAjH86hiEAcOeRI2EeK8zCkHDrFykh/Al8mvJeFmjy3UrE7GYQjNwOgbGUUtCn5/k8CB8zIu7QA==
7053+
70447054
"@svgr/babel-plugin-add-jsx-attribute@^6.5.1":
70457055
version "6.5.1"
70467056
resolved "https://registry.yarnpkg.com/@svgr/babel-plugin-add-jsx-attribute/-/babel-plugin-add-jsx-attribute-6.5.1.tgz#74a5d648bd0347bda99d82409d87b8ca80b9a1ba"
@@ -14239,11 +14249,6 @@ emittery@^0.10.2:
1423914249
resolved "https://registry.yarnpkg.com/emittery/-/emittery-0.10.2.tgz#902eec8aedb8c41938c46e9385e9db7e03182933"
1424014250
integrity sha512-aITqOwnLanpHLNXZJENbOgjUBeHocD+xsSJmNrjovKBW5HbSpW3d1pEls7GFQPUWXiwG9+0P4GtHfEqC/4M0Iw==
1424114251

14242-
emoji-regex@^10.1.0:
14243-
version "10.1.0"
14244-
resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-10.1.0.tgz#d50e383743c0f7a5945c47087295afc112e3cf66"
14245-
integrity sha512-xAEnNCT3w2Tg6MA7ly6QqYJvEoY1tm9iIjJ3yMKK9JPlWuRHAMoe5iETwQnx3M9TVbFMfsrBgWKR+IsmswwNjg==
14246-
1424714252
emoji-regex@^7.0.1:
1424814253
version "7.0.3"
1424914254
resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-7.0.3.tgz#933a04052860c85e83c122479c4748a8e4c72156"
@@ -25579,22 +25584,19 @@ preserve@^0.2.0:
2557925584
resolved "https://registry.yarnpkg.com/preserve/-/preserve-0.2.0.tgz#815ed1f6ebc65926f865b310c0713bcb3315ce4b"
2558025585
integrity sha1-gV7R9uvGWSb4ZbMQwHE7yzMVzks=
2558125586

25582-
prettier-plugin-solidity@^1.0.0-beta.24:
25583-
version "1.0.0-beta.24"
25584-
resolved "https://registry.yarnpkg.com/prettier-plugin-solidity/-/prettier-plugin-solidity-1.0.0-beta.24.tgz#67573ca87098c14f7ccff3639ddd8a4cab2a87eb"
25585-
integrity sha512-6JlV5BBTWzmDSq4kZ9PTXc3eLOX7DF5HpbqmmaF+kloyUwOZbJ12hIYsUaZh2fVgZdV2t0vWcvY6qhILhlzgqg==
25587+
prettier-plugin-solidity@^2.1.0:
25588+
version "2.1.0"
25589+
resolved "https://registry.yarnpkg.com/prettier-plugin-solidity/-/prettier-plugin-solidity-2.1.0.tgz#2298aefc92c5ebd3a0323f98151d2a82f38fc7c6"
25590+
integrity sha512-O5HX4/PCE5aqiaEiNGbSRLbSBZQ6kLswAav5LBSewwzhT+sZlN6iAaLZlZcJzPEnIAxwLEHP03xKEg92fflT9Q==
2558625591
dependencies:
25587-
"@solidity-parser/parser" "^0.14.3"
25588-
emoji-regex "^10.1.0"
25589-
escape-string-regexp "^4.0.0"
25590-
semver "^7.3.7"
25591-
solidity-comments-extractor "^0.0.7"
25592-
string-width "^4.2.3"
25592+
"@nomicfoundation/slang" "1.2.0"
25593+
"@solidity-parser/parser" "^0.20.1"
25594+
semver "^7.7.2"
2559325595

25594-
prettier@^2.8.4:
25595-
version "2.8.4"
25596-
resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.8.4.tgz#34dd2595629bfbb79d344ac4a91ff948694463c3"
25597-
integrity sha512-vIS4Rlc2FNh0BySk3Wkd6xmwxB0FpOndW5fisM5H8hsZSxU2VWVB5CWIkIjWvrHjIhxk2g3bfMKM87zNTrZddw==
25596+
prettier@^3.6.2:
25597+
version "3.6.2"
25598+
resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.6.2.tgz#ccda02a1003ebbb2bfda6f83a074978f608b9393"
25599+
integrity sha512-I7AIg5boAr5R0FFtJ6rCfD+LFsWHp81dolrFD8S79U9tb8Az2nGrJncnMSnys+bpQJfRUzqs9hnA81OAA3hCuQ==
2559825600

2559925601
pretty-format@^27.0.2:
2560025602
version "27.5.1"
@@ -27892,6 +27894,11 @@ semver@^7.5.4:
2789227894
dependencies:
2789327895
lru-cache "^6.0.0"
2789427896

27897+
semver@^7.7.2:
27898+
version "7.7.2"
27899+
resolved "https://registry.yarnpkg.com/semver/-/semver-7.7.2.tgz#67d99fdcd35cec21e6f8b87a7fd515a33f982b58"
27900+
integrity sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA==
27901+
2789527902
semver@~5.3.0:
2789627903
version "5.3.0"
2789727904
resolved "https://registry.yarnpkg.com/semver/-/semver-5.3.0.tgz#9b2ce5d3de02d17c6012ad326aa6b4d0cf54f94f"
@@ -28455,10 +28462,10 @@ solidity-ast@^0.4.51:
2845528462
dependencies:
2845628463
array.prototype.findlast "^1.2.2"
2845728464

28458-
solidity-comments-extractor@^0.0.7:
28459-
version "0.0.7"
28460-
resolved "https://registry.yarnpkg.com/solidity-comments-extractor/-/solidity-comments-extractor-0.0.7.tgz#99d8f1361438f84019795d928b931f4e5c39ca19"
28461-
integrity sha512-wciNMLg/Irp8OKGrh3S2tfvZiZ0NEyILfcRCXCD4mp7SgK/i9gzLfhY2hY7VMCQJ3kH9UB9BzNdibIVMchzyYw==
28465+
solidity-comments-extractor@^0.0.8:
28466+
version "0.0.8"
28467+
resolved "https://registry.yarnpkg.com/solidity-comments-extractor/-/solidity-comments-extractor-0.0.8.tgz#f6e148ab0c49f30c1abcbecb8b8df01ed8e879f8"
28468+
integrity sha512-htM7Vn6LhHreR+EglVMd2s+sZhcXAirB1Zlyrv5zBuTxieCvjfnRpd7iZk75m/u6NOlEyQ94C6TWbBn2cY7w8g==
2846228469

2846328470
sonic-boom@^2.2.1:
2846428471
version "2.8.0"

0 commit comments

Comments
 (0)