Skip to content

Commit 1cf3dfd

Browse files
authored
Merge pull request #1056 from prettier-solidity/slang-0.18.0
Slang 0.18.3
2 parents 921b501 + a0316e5 commit 1cf3dfd

File tree

310 files changed

+1903
-2074
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

310 files changed

+1903
-2074
lines changed

.github/workflows/CI.yml

Lines changed: 10 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -23,26 +23,8 @@ 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
43-
44-
test_prettier_v2:
45-
name: Prettier V2
26+
test_bundle:
27+
name: Test production
4628
runs-on: ubuntu-latest
4729
steps:
4830
- uses: actions/checkout@v3
@@ -52,14 +34,12 @@ jobs:
5234
cache: 'npm'
5335
- name: Install
5436
run: npm install
55-
- name: Build with Prettier V3
37+
- name: Build
5638
run: npm run build
57-
- name: Downgrade Prettier to V2
58-
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
39+
- name: Build test app
40+
run: npm run build:test
41+
- name: Run tests
42+
run: npm run test:standalone -- --runInBand
6343

6444
test_linux:
6545
name: Test on Linux with Node ${{ matrix.node }}
@@ -76,7 +56,7 @@ jobs:
7656
- name: Install
7757
run: npm install
7858
- name: Run tests
79-
run: npm run test:all
59+
run: npm run test:all -- --runInBand
8060

8161
test_macos:
8262
name: Test on MacOS with Node 16
@@ -90,7 +70,7 @@ jobs:
9070
- name: Install
9171
run: npm install
9272
- name: Run tests
93-
run: npm run test:all
73+
run: npm run test:all -- --runInBand
9474

9575
test_windows:
9676
name: Test on Windows with Node 16
@@ -104,4 +84,4 @@ jobs:
10484
- name: Install
10585
run: npm install
10686
- name: Run tests
107-
run: npm run test:all
87+
run: npm run test:all -- --runInBand

README.md

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ Install both `prettier` and `prettier-plugin-solidity`:
2626
npm install --save-dev prettier prettier-plugin-solidity
2727
```
2828

29+
> :package: ** Make sure `prettier`'s version is at least `3.0.0`**
30+
2931
Run prettier in your contracts:
3032

3133
```Bash
@@ -46,25 +48,27 @@ Or you can use it as part of your linting to check that all your code is prettif
4648

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

5153
_Added in v1.1.0_
5254

5355
To use this package in the browser, you need to load Prettier's standalone bundle before loading the build provided in this package.
5456

55-
```html
56-
<script src="https://unpkg.com/prettier@latest"></script>
57-
<script src="https://unpkg.com/prettier-plugin-solidity@latest"></script>
58-
```
59-
6057
Prettier's unpkg field points to `https://unpkg.com/prettier/standalone.js`, in a similar way this plugin points to `https://unpkg.com/prettier-plugin-solidity/dist/standalone.js`.
6158

6259
Once the scripts are loaded you will have access the globals `prettier` and `prettierPlugins`.
6360

6461
We follow Prettier's strategy for populating their plugins in the object `prettierPlugins`, you can load other plugins like `https://unpkg.com/[email protected]/parser-markdown.js` and Prettier will have access to multiple parsers.
6562

6663
```html
67-
<script>
64+
<script type="module">
65+
const prettier = await import(
66+
'https://unpkg.com/prettier-plugin-solidity@latest'
67+
);
68+
const prettierSolidity = await import(
69+
'https://unpkg.com/prettier-plugin-solidity@latest'
70+
);
71+
6872
async function format(code) {
6973
return await prettier.format(code, {
7074
parser: 'slang-solidity',
@@ -79,7 +83,7 @@ We follow Prettier's strategy for populating their plugins in the object `pretti
7983

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

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

8488
_Added in v1.2.0_
8589

0 commit comments

Comments
 (0)