Skip to content

Commit 7e89009

Browse files
authored
prettier-comments (#71)
* integration w/ example * fix snap * add src from prettier-comments * fix eslint * fix prettier * fix codecov * fix jest coverage * bump version
1 parent 11363ca commit 7e89009

File tree

12 files changed

+1593
-17
lines changed

12 files changed

+1593
-17
lines changed

.travis.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
after_script:
22
- npm run coverage
3-
language:
4-
node_js
3+
language: node_js
54
node_js:
6-
- "6"
7-
- "8"
8-
- "10"
5+
- '6'
6+
- '8'
7+
- '10'
98
script:
109
- npm run lint
1110
- npm test

codecov.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
ignore:
2+
- 'src/prettier-comments/**/*'

dependencies.yml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
collectors:
2-
3-
- type: js-npm
4-
path: /
5-
actors:
6-
# pull requests for all major, minor, and patch updates
72
- type: js-npm
8-
versions: "Y.Y.Y"
3+
path: /
4+
actors:
5+
# pull requests for all major, minor, and patch updates
6+
- type: js-npm
7+
versions: 'Y.Y.Y'

jest.config.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
module.exports = {
22
collectCoverage: true,
3-
collectCoverageFrom: ['src/**/*.js', '!<rootDir>/node_modules/'],
3+
collectCoverageFrom: [
4+
'src/**/*.js',
5+
'!<rootDir>/node_modules/',
6+
'!src/prettier-comments/**/*.js'
7+
],
48
coverageDirectory: './coverage/',
59
setupFiles: ['<rootDir>/tests_config/run_spec.js'],
610
snapshotSerializers: ['<rootDir>/tests_config/raw-serializer.js'],

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
{
22
"name": "prettier-plugin-solidity",
3-
"version": "1.0.0-alpha.10",
3+
"version": "1.0.0-alpha.11",
44
"description": "prettier plugin for solidity",
55
"main": "src",
66
"scripts": {
77
"coverage": "codecov",
8-
"eslint": "eslint src/**",
8+
"eslint": "eslint --ignore-pattern 'src/prettier-comments/**' 'src/**'",
99
"lint": "npm run eslint && npm run prettier -- --list-different",
1010
"lint:fix": "npm run eslint -- --fix && npm run prettier -- --write",
11-
"prettier": "prettier \"{.,{src,tests_config}/**}/*.{js{,on},md}\" \"tests/**/jsfmt.spec.js\"",
11+
"prettier": "prettier '{.,{src,tests_config}/**}/*.{js{,on},md}' 'tests/**/jsfmt.spec.js' '!src/prettier-comments/**/*'",
1212
"test": "jest"
1313
},
1414
"repository": {

src/index.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
const { handleComments } = require('./prettier-comments');
2+
13
const massageAstNode = require('./clean');
24
const loc = require('./loc');
35
const parse = require('./parser');
@@ -41,6 +43,12 @@ function printComment(commentPath) {
4143
const printers = {
4244
'solidity-ast': {
4345
canAttachComment,
46+
handleComments: {
47+
ownLine: handleComments.handleOwnLineComment,
48+
endOfLine: handleComments.handleEndOfLineComment,
49+
remaining: handleComments.handleRemainingComment
50+
},
51+
isBlockComment: handleComments.isBlockComment,
4452
massageAstNode,
4553
print,
4654
printComment

0 commit comments

Comments
 (0)