Skip to content

Commit dd7bdd3

Browse files
committed
preparing release
1 parent a269f56 commit dd7bdd3

5 files changed

Lines changed: 42 additions & 49 deletions

File tree

.github/workflows/CI.yml

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -23,23 +23,23 @@ jobs:
2323
- name: lint
2424
run: npm run lint
2525

26-
test_bundle:
27-
name: Test production
28-
runs-on: ubuntu-latest
29-
steps:
30-
- uses: actions/checkout@v3
31-
- uses: actions/setup-node@v3
32-
with:
33-
node-version: 16
34-
cache: 'npm'
35-
- name: Install
36-
run: npm install
37-
- name: Build
38-
run: npm run build
39-
- name: Build test app
40-
run: npm run build:test
41-
- name: Run tests
42-
run: npm run test:standalone
26+
# test_bundle:
27+
# name: Test production
28+
# runs-on: ubuntu-latest
29+
# steps:
30+
# - uses: actions/checkout@v3
31+
# - uses: actions/setup-node@v3
32+
# with:
33+
# node-version: 16
34+
# cache: 'npm'
35+
# - name: Install
36+
# run: npm install
37+
# - name: Build
38+
# run: npm run build
39+
# - name: Build test app
40+
# run: npm run build:test
41+
# - name: Run tests
42+
# run: npm run test:standalone
4343

4444
test_prettier_v2:
4545
name: Prettier V2
@@ -56,10 +56,10 @@ jobs:
5656
run: npm run build
5757
- name: Downgrade Prettier to V2
5858
run: npm install [email protected]
59-
- name: Build test app
60-
run: npm run build:test
61-
- name: Run standalone tests
62-
run: npm run test:standalone
59+
# - name: Build test app
60+
# run: npm run build:test
61+
# - name: Run standalone tests
62+
# run: npm run test:standalone
6363

6464
test_linux:
6565
name: Test on Linux with Node ${{ matrix.node }}

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2021 prettier-solidity
3+
Copyright (c) 2024 prettier-solidity
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@
1010

1111
A [Prettier plugin](https://prettier.io/docs/en/plugins.html) for automatically formatting your [Solidity](https://github.com/ethereum/solidity) code.
1212

13+
## Nomic Foundation`s Slang
14+
15+
Nomic Foundation has put a lot of effort in providing a set of compiler APIs that helped us rethink our approach to parsing and rely on their flexibility, detail oriented solution and continuos support of new and old Solidity syntaxes.
16+
17+
Since v2.0.0 this package will ship with the Slang parser and this change must be implemented in existing configurations by replacing `parser: 'solidity-parse'` with `parser: 'slang'`.
18+
1319
## Installation and usage
1420

1521
### Using in NodeJS
@@ -40,7 +46,7 @@ Or you can use it as part of your linting to check that all your code is prettif
4046

4147
> Prettier Solidity only works with valid code. If there is a syntax error, nothing will be done and a parser error will be thrown.
4248
43-
### Using in the Browser
49+
### ~~Using in the Browser~~ _Disabled during v2.0.0-beta_
4450

4551
_Added in v1.1.0_
4652

@@ -73,7 +79,7 @@ We follow Prettier's strategy for populating their plugins in the object `pretti
7379

7480
For more details and please have a look at [Prettier's documentation](https://prettier.io/docs/en/browser.html).
7581

76-
### Creating a package for the Browser
82+
### ~~Creating a package for the Browser~~ _Disabled during v2.0.0-beta_
7783

7884
_Added in v1.2.0_
7985

@@ -85,7 +91,7 @@ import solidityPlugin from 'prettier-plugin-solidity/standalone';
8591

8692
async function format(code) {
8793
return await prettier.format(code, {
88-
parser: "solidity-parse",
94+
parser: "slang",
8995
plugins: [solidityPlugin],
9096
});
9197
}
@@ -106,7 +112,7 @@ The following is the default configuration internally used by this plugin.
106112
{
107113
"files": "*.sol",
108114
"options": {
109-
"parser": "solidity-parse",
115+
"parser": "slang",
110116
"printWidth": 80,
111117
"tabWidth": 4,
112118
"useTabs": false,

package.json

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,18 @@
11
{
22
"name": "prettier-plugin-solidity",
3-
"version": "1.3.1",
3+
"version": "2.0.0-beta",
44
"description": "A Prettier Plugin for automatically formatting your Solidity code.",
55
"type": "module",
6-
"main": "./src/index.js",
7-
"browser": "./dist/standalone.cjs",
8-
"unpkg": "./dist/standalone.cjs",
9-
"exports": {
10-
".": {
11-
"import": "./src/index.js",
12-
"require": "./dist/standalone.cjs"
13-
},
14-
"./standalone": {
15-
"default": "./dist/standalone.cjs"
16-
}
17-
},
6+
"main": "./dist/index.js",
187
"scripts": {
19-
"build": "webpack --env production",
20-
"build:dev": "webpack --env development",
21-
"build:test": "webpack --config test.config.js",
8+
"build": "npx tsc",
229
"eslint": "eslint 'src/**' 'tests/**'",
2310
"lint": "npm run eslint && npm run prettier -- --list-different",
2411
"lint:fix": "npm run eslint -- --fix && npm run prettier -- --write",
2512
"prepublishOnly": "npm run build",
2613
"prettier": "prettier './*.{ts,js,cjs,json,md,yml}' '{src,tests}/**/*.{ts,js,cjs}'",
2714
"test": "NODE_OPTIONS=\"--loader=ts-node/esm --loader=esmock\" jest",
28-
"test:all": "cross-env FULL_TEST=1 NODE_OPTIONS=\"--loader=ts-node/esm --loader=esmock\" c8 jest",
29-
"test:standalone": "cross-env TEST_STANDALONE=1 FULL_TEST=1 jest"
15+
"test:all": "cross-env FULL_TEST=1 NODE_OPTIONS=\"--loader=ts-node/esm --loader=esmock\" c8 jest"
3016
},
3117
"files": [
3218
"src",
@@ -42,6 +28,7 @@
4228
"ethereum",
4329
"plugin",
4430
"prettier",
31+
"slang",
4532
"solidity"
4633
],
4734
"author": {

src/index.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ const languages: SupportLanguage[] = [
3131
aceMode: 'text',
3232
tmScope: 'source.solidity',
3333
extensions: ['.sol'],
34-
parsers: ['solidity-parse', parserName],
34+
parsers: [parserName, 'solidity-parse'],
3535
vscodeLanguageIds: ['solidity']
3636
}
3737
];
@@ -46,8 +46,8 @@ const slangParser: Parser<AstNode> = {
4646
};
4747

4848
const parsers = {
49-
'solidity-parse': parser,
50-
[parserName]: slangParser
49+
[parserName]: slangParser,
50+
'solidity-parse': parser
5151
};
5252

5353
const solidityCanAttachComment = (node: { type: string }): boolean =>
@@ -83,8 +83,8 @@ const slangPrinter: Printer<AstNode> = {
8383
};
8484

8585
const printers = {
86-
'solidity-ast': printer,
87-
[astFormat]: slangPrinter
86+
[astFormat]: slangPrinter,
87+
'solidity-ast': printer
8888
};
8989

9090
// https://prettier.io/docs/en/plugins.html#defaultoptions

0 commit comments

Comments
 (0)