Skip to content

Commit aca2dac

Browse files
authored
[WIP] genericPrint - PragmaDirective (#4)
* print PragmaDirective * moar prettier features * fix readme * moar prettier ?!? * even moar prettier ?!? * add ContractDefinition * travis-ci (#6) * add config file * fix test script * print PragmaDirective * moar prettier features * fix readme * moar prettier ?!? * even moar prettier ?!? * add ContractDefinition * Add tests (#5) * Install Jest and add a test * Enable Prettier on the codebase * Remove unused variables and inline CI check * Always use the `filepath` option * Remove location data from the AST when comparing with the printed AST * Run the linter in CI * Remove excess `hardline`s; use `literalline`s in the `default` case * Break `pragma` declarations when they go past the `printWidth` * Add the test case in the PR’s body * add eslint comments * skip npm run lint (wip) * re add npm run lint
1 parent 6fb2988 commit aca2dac

19 files changed

Lines changed: 5468 additions & 1150 deletions

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,5 @@ typings/
5959

6060
# next.js build output
6161
.next
62+
63+
loc

.travis.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,6 @@ node_js:
33
- "6"
44
- "8"
55
- "10"
6+
script:
7+
- npm test
8+
- npm run lint

README.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,18 @@
22

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

5+
## Resources
6+
7+
- https://github.com/mattiaerre/prettier-plugin-solidity/issues/2
8+
9+
## Test
10+
11+
```bash
12+
node_modules/.bin/prettier --write **/*.sol --plugin=./src
13+
```
14+
515
## Use
616

717
```bash
8-
node_modules/prettier/bin-prettier.js --write **/*.sol --plugin=./node_modules/prettier-plugin-solidity
18+
node_modules/.bin/prettier --write **/*.sol --plugin=./node_modules/prettier-plugin-solidity
919
```

jest.config.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
'use strict';
2+
3+
module.exports = {
4+
setupFiles: ['<rootDir>/tests_config/run_spec.js'],
5+
snapshotSerializers: ['<rootDir>/tests_config/raw-serializer.js'],
6+
testRegex: 'jsfmt\\.spec\\.js$|__tests__/.*\\.js$',
7+
collectCoverage: !!process.env.CI,
8+
collectCoverageFrom: ['src/**/*.js', '!<rootDir>/node_modules/'],
9+
testEnvironment: 'node',
10+
transform: {},
11+
watchPlugins: [
12+
'jest-watch-typeahead/filename',
13+
'jest-watch-typeahead/testname'
14+
]
15+
};

0 commit comments

Comments
 (0)