Skip to content

Commit a651e37

Browse files
committed
format(lint): base
Signed-off-by: sam bacha <[email protected]>
1 parent b6612f7 commit a651e37

5 files changed

Lines changed: 55 additions & 49 deletions

File tree

.github/workflows/nodejs.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
name: nodejs
33
on:
44
push:
5-
paths:
6-
- "**/**"
7-
- "!**/*.md/**"
5+
paths:
6+
- '**/**'
7+
- '!**/*.md/**'
88

99
defaults:
1010
run:
@@ -36,10 +36,10 @@ jobs:
3636

3737
- name: Install npm dependencies
3838
run: |
39-
npm install
40-
echo "::set-output name=install::nodejs"
39+
npm install
40+
echo "::set-output name=install::nodejs"
4141
- name: Run Test
4242
- uses: codecov/codecov-action@v2
4343
run: npm test -- -u
4444
env:
45-
CODECOV_TOKEN: 6ec88e00-584c-438e-b5a2-c220fc764ee4
45+
CODECOV_TOKEN: 6ec88e00-584c-438e-b5a2-c220fc764ee4

README.md

Lines changed: 29 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
<h1 align="center">
32
<br>
43
prettier-config-solidity
@@ -8,27 +7,23 @@
87
a conformant prettier configuration for Solidity
98
</p>
109

11-
1210
[![nodejs](https://github.com/sambacha/prettier-config-solidity/actions/workflows/nodejs.yml/badge.svg)](https://github.com/sambacha/prettier-config-solidity/actions/workflows/nodejs.yml)
1311
[![codecov](https://codecov.io/gh/sambacha/prettier-solidity-config/branch/master/graph/badge.svg?token=1k3OYjAl8C)](https://codecov.io/gh/sambacha/prettier-solidity-config)
1412

15-
16-
* [Quickstart](#quickstart)
17-
* [Overview](#overview)
18-
* [Motivation](#motivation)
19-
+ [Reducing AST Churn](#whitespace)
20-
- [whitespace](#whitespace)
21-
- [arrow-parens](#arrow-parens)
22-
- [one var](#one-var)
23-
* [Install](#install)
24-
- [Prettier](#prettier)
25-
- [with SolHint](#with-solhint)
26-
* [License](#license)
27-
13+
- [Quickstart](#quickstart)
14+
- [Overview](#overview)
15+
- [Motivation](#motivation)
16+
- [Reducing AST Churn](#whitespace)
17+
- [whitespace](#whitespace)
18+
- [arrow-parens](#arrow-parens)
19+
- [one var](#one-var)
20+
- [Install](#install)
21+
- [Prettier](#prettier)
22+
- [with SolHint](#with-solhint)
23+
- [License](#license)
2824

2925
## Quickstart
3026

31-
3227
- create `prettier.config.js` file
3328

3429
```js
@@ -37,7 +32,8 @@ const prettierConfig = require('prettier-config-solidity');
3732
module.exports = prettierConfig;
3833
```
3934

40-
- install
35+
- install
36+
4137
```bash
4238
npm i -D prettier prettier-plugin-solidity@latest prettier-config-solidity --save-exact
4339
```
@@ -48,16 +44,19 @@ Prettier configuration for Solidity
4844

4945
## Motivation
5046

51-
This configuration is optimized to reduce **diff churn** and improve AST results.
47+
This configuration is optimized to reduce **diff churn** and improve AST
48+
results.
5249

53-
The following rules are employed, with specific reasonings to their choice (source: airbnb style
54-
guide):
50+
The following rules are employed, with specific reasonings to their choice
51+
(source: airbnb style guide):
5552

5653
## `printWidth`
5754

58-
The behavior of `printWidth` is located here: [prettier-solidity/prettier-plugin-solidity/blob/b504261047d0019c924d53a2b9ab0738b1e05703/src/nodes/FunctionDefinition.js#L99](https://github.com/prettier-solidity/prettier-plugin-solidity/blob/b504261047d0019c924d53a2b9ab0738b1e05703/src/nodes/FunctionDefinition.js#L99)
55+
The behavior of `printWidth` is located here:
56+
[prettier-solidity/prettier-plugin-solidity/blob/b504261047d0019c924d53a2b9ab0738b1e05703/src/nodes/FunctionDefinition.js#L99](https://github.com/prettier-solidity/prettier-plugin-solidity/blob/b504261047d0019c924d53a2b9ab0738b1e05703/src/nodes/FunctionDefinition.js#L99)
5957

60-
See more here [prettier-plugin-solidity/issues/474#issuecomment-823670541](https://github.com/prettier-solidity/prettier-plugin-solidity/issues/474#issuecomment-823670541)
58+
See more here
59+
[prettier-plugin-solidity/issues/474#issuecomment-823670541](https://github.com/prettier-solidity/prettier-plugin-solidity/issues/474#issuecomment-823670541)
6160

6261
### whitespace
6362

@@ -75,7 +74,8 @@ const foo = { clark: 'kent' };
7574

7675
#### arrow-parens
7776

78-
- 8.4 Always include parentheses around arguments for clarity and consistency. eslint: arrow-parens
77+
- 8.4 Always include parentheses around arguments for clarity and consistency.
78+
eslint: arrow-parens
7979

8080
[source@airbnb/javascript#arrows--one-arg-parens](https://github.com/airbnb/javascript#arrows--one-arg-parens)
8181

@@ -115,11 +115,13 @@ const foo = { clark: 'kent' };
115115

116116
#### one var
117117

118-
- 13.2 Use one const or let declaration per variable or assignment. eslint: one-var
118+
- 13.2 Use one const or let declaration per variable or assignment. eslint:
119+
one-var
119120

120-
> Why? It’s easier to add new variable declarations this way, and you never have to worry about
121-
> swapping out a ; for a , or introducing punctuation-only diffs. You can also step through each
122-
> declaration with the debugger, instead of jumping through all of them at once.
121+
> Why? It’s easier to add new variable declarations this way, and you never have
122+
> to worry about swapping out a ; for a , or introducing punctuation-only diffs.
123+
> You can also step through each declaration with the debugger, instead of
124+
> jumping through all of them at once.
123125
124126
##### [ref:eslint/rules/one-var](https://eslint.org/docs/rules/one-var)
125127

@@ -209,7 +211,6 @@ npm install --save-dev solhint solhint-plugin-prettier prettier prettier-plugin-
209211
}
210212
```
211213

212-
213214
## License
214215

215216
SPDX-License-Identifier: Apache-2.0

jest.config.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,51 @@
11
/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
22
const FULL_TEST = Boolean(process.env.FULL_TEST);
33
// jest.config.js
4-
const {defaults} = require('jest-config');
4+
const { defaults } = require('jest-config');
55

6-
const CONSOLE_FAIL_TYPES = ['error', 'warn']
6+
const CONSOLE_FAIL_TYPES = ['error', 'warn'];
77

88
// Throw errors when a `console.error` or `console.warn` happens
99
// by overriding the functions
1010
CONSOLE_FAIL_TYPES.forEach((type) => {
1111
console[type] = (message) => {
1212
throw new VError.errorFromList(
1313
`Failing due to console.${type} while running test!\n\n${message}`,
14-
)
15-
}
16-
})
14+
);
15+
};
16+
});
1717
module.exports = {
1818
collectCoverage: FULL_TEST,
1919
collectCoverageFrom: [
20-
"__tests__/**/*.js",
20+
'__tests__/**/*.js',
2121
'!scripts/**/*.js',
2222
'!scripts/generateIndexes.js',
2323
'src/**/*.js',
2424
'!<rootDir>/node_modules/',
25-
'!src/prettier-comments/**/*.js'
25+
'!src/prettier-comments/**/*.js',
2626
],
27-
"coverageReporters": ["clover", "json", "lcov"],
27+
coverageReporters: ['clover', 'json', 'lcov'],
2828
coverageDirectory: './coverage/',
2929
coveragePathIgnorePatterns: ['/node_modules/', '/scripts/'],
3030
coverageThreshold: {
3131
global: {
3232
branches: 100,
3333
functions: 100,
3434
lines: 100,
35-
statements: 100
36-
}
35+
statements: 100,
36+
},
3737
},
3838
setupFiles: ['<rootDir>/tests/config/setup.js'],
3939
snapshotSerializers: [
4040
'jest-snapshot-serializer-raw',
41-
'jest-snapshot-serializer-ansi'
41+
'jest-snapshot-serializer-ansi',
4242
],
4343
testTimeout: 12500,
4444
testEnvironment: 'node',
4545
testRegex: 'jsfmt\\.spec\\.js$|tests/unit/.*\\.js$',
4646
transform: {},
4747
watchPlugins: [
4848
'jest-watch-typeahead/filename',
49-
'jest-watch-typeahead/testname'
50-
]
49+
'jest-watch-typeahead/testname',
50+
],
5151
};

scripts/generateIndexes.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@ if (process.env.SCRIPT === 'true') {
77
// eslint-disable-next-line no-param-reassign
88
options.parser = 'babel';
99
['../src'].forEach((dir) => {
10-
fs.writeFileSync(`${__dirname}/${dir}/config.js`, prettier.format(makeData(dir), options));
10+
fs.writeFileSync(
11+
`${__dirname}/${dir}/config.js`,
12+
prettier.format(makeData(dir), options),
13+
);
1114
});
1215
});
1316
}

scripts/makeData.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ function makeData(dir) {
88
return accumulator;
99
}, {});
1010

11-
const data = `/* This file was automatically generated on ${Date.now() / 1000} */
11+
const data = `/* This file was automatically generated on ${
12+
Date.now() / 1000
13+
} */
1214
1315
/* eslint-disable global-require */
1416

0 commit comments

Comments
 (0)