Skip to content

Commit 908c123

Browse files
committed
use solidity-parser-antlr
1 parent 99cba21 commit 908c123

6 files changed

Lines changed: 24 additions & 12 deletions

File tree

.eslintrc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"extends": "airbnb",
33
"rules": {
44
"arrow-parens": "off",
5-
"comma-dangle": "off"
5+
"comma-dangle": "off",
6+
"object-curly-newline": "off"
67
}
78
}

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# prettier-plugin-solidity
22

3-
work in progress prettier plugin for solidity
3+
work in progress [prettier plugin](https://github.com/prettier/prettier/issues/4180) for [solidity](https://github.com/ethereum/solidity)
44

55
## Use
66

package-lock.json

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,9 @@
3131
"eslint-plugin-import": "^2.11.0",
3232
"eslint-plugin-jsx-a11y": "^6.0.3",
3333
"eslint-plugin-react": "^7.8.2"
34+
},
35+
"dependencies": {
36+
"prettier": "^1.12.1",
37+
"solidity-parser-antlr": "^0.2.10"
3438
}
3539
}

src/parser.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1+
const parser = require('solidity-parser-antlr');
2+
13
// https://prettier.io/docs/en/plugins.html#parsers
2-
const parse = text => ({
3-
ast_type: 'solidity-format',
4-
body: text,
5-
end: text.legth,
6-
source: text,
7-
start: 0
8-
});
4+
// eslint-disable-next-line arrow-body-style
5+
const parse = text => {
6+
return parser.parse(text);
7+
};
98

109
module.exports = parse;

src/printer.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
11
// https://prettier.io/docs/en/plugins.html#printers
2-
const print = (path, options) => options.originalText;
3-
4-
module.exports = print;
2+
module.exports = (path, options) => options.originalText;

0 commit comments

Comments
 (0)