Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@ dist/**/*.js
tests/format/**/*.sol
tests/format/Markdown/Markdown.md
tests/format/RespectDefaultOptions/respect-default-options.js
src/prettier-comments/**/*.js
14 changes: 4 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,6 @@ The Solidity versions taken into consideration during formatting are:
// Input
import { Foo as Bar, Baz as Qux } from "/an/extremely/long/location";

// "compiler": undefined, parser: "antlr"
import { Foo as Bar, Baz as Qux } from "/an/extremely/long/location";

// "compiler": "0.7.3" (or lesser)
import { Foo as Bar, Baz as Qux } from "/an/extremely/long/location";

Expand Down Expand Up @@ -207,16 +204,13 @@ You might have a multi-version project, where different files are compiled with
}
```

| Default | CLI Override | API Override |
| --------------------------------------------------------------------------------------------- | --------------------- | ---------------------- |
| Inferred from pragma statements when using parser `slang`<br/> None when using parser `antlr` | `--compiler <string>` | `compiler: "<string>"` |
| Default | CLI Override | API Override |
| ------------------------------- | --------------------- | ---------------------- |
| Inferred from pragma statements | `--compiler <string>` | `compiler: "<string>"` |

### Parser

You can configure the parser used by Prettier Solidity. Two Solidity parsers are supported:

- [Slang](https://nomicfoundation.github.io/slang) (the default), a more powerful and correct parser that results in better formatting for some edge cases, especially when comments are involved.
- [Solidity Parser for JavaScript](https://github.com/solidity-parser/parser/), an [ANTLR](https://www.antlr.org/)-based parser. This is the version that Prettier Solidity v1 used by default. This parser is still supported in v2, but it's deprecated and will be removed in the next major version. You can use this parser by setting `parser: "antlr"` in your Prettier configuration.
- [Slang](https://nomicfoundation.github.io/slang), a powerful parser created and maintained by Nomic Foundation.

| Default | CLI Override | API Override |
| ------- | ------------------- | -------------------- |
Expand Down
3 changes: 1 addition & 2 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ export default [
'tests/format/**/*.sol',
'tests/format/Markdown/Markdown.md',
'tests/format/RespectDefaultOptions/respect-default-options.js',
'tests/config/**/*.*js',
'src/prettier-comments/**/*.js'
'tests/config/**/*.*js'
]
},
{
Expand Down
11 changes: 2 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "prettier-plugin-solidity",
"version": "2.4.1",
"version": "3.0.0",
"description": "A Prettier Plugin for automatically formatting your Solidity code.",
"type": "module",
"main": "./dist/index.js",
Expand Down Expand Up @@ -116,7 +116,6 @@
},
"dependencies": {
"@nomicfoundation/slang": "1.3.8",
"@solidity-parser/parser": "^0.20.2",
"semver": "^7.8.5"
},
"peerDependencies": {
Expand Down
11 changes: 0 additions & 11 deletions src/binary-operator-printers/addition.js

This file was deleted.

26 changes: 0 additions & 26 deletions src/binary-operator-printers/assignment.js

This file was deleted.

9 changes: 0 additions & 9 deletions src/binary-operator-printers/bit.js

This file was deleted.

7 changes: 0 additions & 7 deletions src/binary-operator-printers/equality.js

This file was deleted.

28 changes: 0 additions & 28 deletions src/binary-operator-printers/exponentiation.js

This file was deleted.

9 changes: 0 additions & 9 deletions src/binary-operator-printers/index.js

This file was deleted.

8 changes: 0 additions & 8 deletions src/binary-operator-printers/inequality.js

This file was deleted.

27 changes: 0 additions & 27 deletions src/binary-operator-printers/logical.js

This file was deleted.

19 changes: 0 additions & 19 deletions src/binary-operator-printers/multiplication.js

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

10 changes: 0 additions & 10 deletions src/binary-operator-printers/shift.js

This file was deleted.

3 changes: 0 additions & 3 deletions src/binary-operator-printers/utils/should-group-or-indent.js

This file was deleted.

2 changes: 1 addition & 1 deletion src/clean.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Prettier offers a clean way to define ignored properties.
const ignoredProperties = new Set(['loc', 'range', 'comments']);
const ignoredProperties = new Set(['loc', 'comments']);
// eslint-disable-next-line @typescript-eslint/no-empty-function
function clean(/* ast, newObj, parent */): void {}
clean.ignoredProperties = ignoredProperties;
Expand Down
Loading
Loading