-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1056 from prettier-solidity/slang-0.18.0
Slang 0.18.3
- Loading branch information
Showing
310 changed files
with
1,903 additions
and
2,074 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,26 +23,8 @@ jobs: | |
- name: lint | ||
run: npm run lint | ||
|
||
# test_bundle: | ||
# name: Test production | ||
# runs-on: ubuntu-latest | ||
# steps: | ||
# - uses: actions/checkout@v3 | ||
# - uses: actions/setup-node@v3 | ||
# with: | ||
# node-version: 16 | ||
# cache: 'npm' | ||
# - name: Install | ||
# run: npm install | ||
# - name: Build | ||
# run: npm run build | ||
# - name: Build test app | ||
# run: npm run build:test | ||
# - name: Run tests | ||
# run: npm run test:standalone | ||
|
||
test_prettier_v2: | ||
name: Prettier V2 | ||
test_bundle: | ||
name: Test production | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
@@ -52,14 +34,12 @@ jobs: | |
cache: 'npm' | ||
- name: Install | ||
run: npm install | ||
- name: Build with Prettier V3 | ||
- name: Build | ||
run: npm run build | ||
- name: Downgrade Prettier to V2 | ||
run: npm install [email protected] | ||
# - name: Build test app | ||
# run: npm run build:test | ||
# - name: Run standalone tests | ||
# run: npm run test:standalone | ||
- name: Build test app | ||
run: npm run build:test | ||
- name: Run tests | ||
run: npm run test:standalone -- --runInBand | ||
|
||
test_linux: | ||
name: Test on Linux with Node ${{ matrix.node }} | ||
|
@@ -76,7 +56,7 @@ jobs: | |
- name: Install | ||
run: npm install | ||
- name: Run tests | ||
run: npm run test:all | ||
run: npm run test:all -- --runInBand | ||
|
||
test_macos: | ||
name: Test on MacOS with Node 16 | ||
|
@@ -90,7 +70,7 @@ jobs: | |
- name: Install | ||
run: npm install | ||
- name: Run tests | ||
run: npm run test:all | ||
run: npm run test:all -- --runInBand | ||
|
||
test_windows: | ||
name: Test on Windows with Node 16 | ||
|
@@ -104,4 +84,4 @@ jobs: | |
- name: Install | ||
run: npm install | ||
- name: Run tests | ||
run: npm run test:all | ||
run: npm run test:all -- --runInBand |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,6 +26,8 @@ Install both `prettier` and `prettier-plugin-solidity`: | |
npm install --save-dev prettier prettier-plugin-solidity | ||
``` | ||
|
||
> :package: ** Make sure `prettier`'s version is at least `3.0.0`** | ||
Run prettier in your contracts: | ||
|
||
```Bash | ||
|
@@ -46,25 +48,27 @@ Or you can use it as part of your linting to check that all your code is prettif | |
|
||
> Prettier Solidity only works with valid code. If there is a syntax error, nothing will be done and a parser error will be thrown. | ||
### ~~Using in the Browser~~ _Disabled during v2.0.0-beta_ | ||
### Using in the Browser | ||
|
||
_Added in v1.1.0_ | ||
|
||
To use this package in the browser, you need to load Prettier's standalone bundle before loading the build provided in this package. | ||
|
||
```html | ||
<script src="https://unpkg.com/prettier@latest"></script> | ||
<script src="https://unpkg.com/prettier-plugin-solidity@latest"></script> | ||
``` | ||
|
||
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`. | ||
|
||
Once the scripts are loaded you will have access the globals `prettier` and `prettierPlugins`. | ||
|
||
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. | ||
|
||
```html | ||
<script> | ||
<script type="module"> | ||
const prettier = await import( | ||
'https://unpkg.com/prettier-plugin-solidity@latest' | ||
); | ||
const prettierSolidity = await import( | ||
'https://unpkg.com/prettier-plugin-solidity@latest' | ||
); | ||
async function format(code) { | ||
return await prettier.format(code, { | ||
parser: 'slang-solidity', | ||
|
@@ -79,7 +83,7 @@ We follow Prettier's strategy for populating their plugins in the object `pretti | |
|
||
For more details and please have a look at [Prettier's documentation](https://prettier.io/docs/en/browser.html). | ||
|
||
### ~~Creating a package for the Browser~~ _Disabled during v2.0.0-beta_ | ||
### Creating a package for the Browser | ||
|
||
_Added in v1.2.0_ | ||
|
||
|
Oops, something went wrong.