Skip to content

Commit

Permalink
prettier-comments (#71)
Browse files Browse the repository at this point in the history
* integration w/ example

* fix snap

* add src from prettier-comments

* fix eslint

* fix prettier

* fix codecov

* fix jest coverage

* bump version
  • Loading branch information
mattiaerre authored Nov 12, 2018
1 parent 11363ca commit 7e89009
Show file tree
Hide file tree
Showing 12 changed files with 1,593 additions and 17 deletions.
9 changes: 4 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
after_script:
- npm run coverage
language:
node_js
language: node_js
node_js:
- "6"
- "8"
- "10"
- '6'
- '8'
- '10'
script:
- npm run lint
- npm test
2 changes: 2 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ignore:
- 'src/prettier-comments/**/*'
11 changes: 5 additions & 6 deletions dependencies.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
collectors:

- type: js-npm
path: /
actors:
# pull requests for all major, minor, and patch updates
- type: js-npm
versions: "Y.Y.Y"
path: /
actors:
# pull requests for all major, minor, and patch updates
- type: js-npm
versions: 'Y.Y.Y'
6 changes: 5 additions & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
module.exports = {
collectCoverage: true,
collectCoverageFrom: ['src/**/*.js', '!<rootDir>/node_modules/'],
collectCoverageFrom: [
'src/**/*.js',
'!<rootDir>/node_modules/',
'!src/prettier-comments/**/*.js'
],
coverageDirectory: './coverage/',
setupFiles: ['<rootDir>/tests_config/run_spec.js'],
snapshotSerializers: ['<rootDir>/tests_config/raw-serializer.js'],
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"name": "prettier-plugin-solidity",
"version": "1.0.0-alpha.10",
"version": "1.0.0-alpha.11",
"description": "prettier plugin for solidity",
"main": "src",
"scripts": {
"coverage": "codecov",
"eslint": "eslint src/**",
"eslint": "eslint --ignore-pattern 'src/prettier-comments/**' 'src/**'",
"lint": "npm run eslint && npm run prettier -- --list-different",
"lint:fix": "npm run eslint -- --fix && npm run prettier -- --write",
"prettier": "prettier \"{.,{src,tests_config}/**}/*.{js{,on},md}\" \"tests/**/jsfmt.spec.js\"",
"prettier": "prettier '{.,{src,tests_config}/**}/*.{js{,on},md}' 'tests/**/jsfmt.spec.js' '!src/prettier-comments/**/*'",
"test": "jest"
},
"repository": {
Expand Down
8 changes: 8 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
const { handleComments } = require('./prettier-comments');

const massageAstNode = require('./clean');
const loc = require('./loc');
const parse = require('./parser');
Expand Down Expand Up @@ -41,6 +43,12 @@ function printComment(commentPath) {
const printers = {
'solidity-ast': {
canAttachComment,
handleComments: {
ownLine: handleComments.handleOwnLineComment,
endOfLine: handleComments.handleEndOfLineComment,
remaining: handleComments.handleRemainingComment
},
isBlockComment: handleComments.isBlockComment,
massageAstNode,
print,
printComment
Expand Down
Loading

0 comments on commit 7e89009

Please sign in to comment.