Skip to content

Commit c78b01e

Browse files
committed
setup rollup, prettier, eslint
1 parent a486ed5 commit c78b01e

9 files changed

+2660
-0
lines changed

.eslintrc.js

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
module.exports = {
2+
plugins: [
3+
'import',
4+
'unused-imports',
5+
'@typescript-eslint'
6+
],
7+
parser: '@typescript-eslint/parser',
8+
parserOptions: {
9+
'ecmaVersion': 2017,
10+
'sourceType': 'module',
11+
'project': './tsconfig.json'
12+
},
13+
rules: {
14+
'curly': ['error', 'all'],
15+
'no-extra-label': 'error',
16+
'no-unused-labels': 'error',
17+
'new-parens': 'error',
18+
'no-new-wrappers': 'error',
19+
'no-debugger': 'error',
20+
'no-duplicate-case': 'error',
21+
'no-throw-literal': 'error',
22+
'no-return-await': 'error',
23+
'no-unsafe-finally': 'error',
24+
'no-unused-expressions': [
25+
'error',
26+
{
27+
'allowShortCircuit': true
28+
}
29+
],
30+
'no-var': 'error',
31+
'object-shorthand': 'error',
32+
'prefer-arrow-callback': [
33+
'error',
34+
{
35+
'allowNamedFunctions': true
36+
}
37+
],
38+
'prefer-const': [
39+
'error',
40+
{
41+
'destructuring': 'all'
42+
}
43+
],
44+
'no-array-constructor': 'error',
45+
'import/no-default-export': 'error',
46+
'import/no-duplicates': 'error',
47+
'unused-imports/no-unused-imports-ts': 'error',
48+
'default-case': 'error',
49+
'@typescript-eslint/no-floating-promises': 'error'
50+
}
51+
};

.gitignore

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Mac OS
2+
.DS_Store
3+
4+
# Yarn
5+
node_modules
6+
yarn-error.log
7+
yarn-debug.log
8+
9+
dist

.npmignore

Whitespace-only changes.

.prettierrc.json

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"singleQuote": true,
3+
"printWidth": 80,
4+
"trailingComma": "none",
5+
"arrowParens": "avoid"
6+
}

package.json

+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
{
2+
"name": "exploring-pioneer",
3+
"version": "1.0.0",
4+
"description": "",
5+
"author": "",
6+
"license": "MIT",
7+
"scripts": {
8+
"prebuild": "tsc --emitDeclarationOnly --declaration -p tsconfig.json",
9+
"build": "rollup -c",
10+
"clean": "rm -rf dist",
11+
"lint": "eslint -c .eslintrc.js '**/*.ts' --ignore-path '.gitignore'",
12+
"prettier": "prettier --write",
13+
"test": "test"
14+
},
15+
"main": "dist/index.cjs.js",
16+
"module": "dist/index.esm.js",
17+
"exports": {
18+
"node": {
19+
"require": "./dist/index.cjs.js",
20+
"import": "./dist/index.esm.js"
21+
},
22+
"default": "./dist/index.esm.js"
23+
},
24+
"types": "./dist/types/index.d.ts",
25+
"repository": {
26+
"type": "git",
27+
"url": "git+https://github.com/alchemyplatform/exploring-pioneer.git"
28+
},
29+
"files": [
30+
"dist"
31+
],
32+
"husky": {
33+
"hooks": {
34+
"pre-commit": "lint-staged"
35+
}
36+
},
37+
"lint-staged": {
38+
"**/*.ts": [
39+
"yarn lint",
40+
"yarn prettier",
41+
"git add"
42+
]
43+
},
44+
"bugs": {
45+
"url": "https://github.com/alchemyplatform/exploring-pioneer/issues"
46+
},
47+
"homepage": "https://github.com/alchemyplatform/exploring-pioneer#readme",
48+
"dependencies": {
49+
"axios": "^0.26.1",
50+
"ethers": "^5.6.1",
51+
"tslib": "^2.3.1"
52+
},
53+
"devDependencies": {
54+
"@typescript-eslint/eslint-plugin": "^5.16.0",
55+
"@typescript-eslint/parser": "^5.16.0",
56+
"eslint": "^8.11.0",
57+
"eslint-plugin-import": "^2.25.4",
58+
"eslint-plugin-unused-imports": "^2.0.0",
59+
"husky": "^7.0.4",
60+
"lint-staged": "^12.3.7",
61+
"prettier": "2.6.0",
62+
"rollup": "^2.70.1",
63+
"rollup-plugin-terser": "^7.0.2",
64+
"rollup-plugin-typescript2": "^0.31.2",
65+
"typescript": "^4.6.2"
66+
}
67+
}

rollup.config.js

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import pkg from './package.json';
2+
import typescriptPlugin from 'rollup-plugin-typescript2';
3+
import { terser } from 'rollup-plugin-terser';
4+
5+
const allBuilds = {
6+
input: 'src/index.ts',
7+
output: [
8+
{
9+
file: pkg.main,
10+
format: 'cjs',
11+
sourcemap: true
12+
},
13+
{
14+
file: pkg.module,
15+
format: 'esm',
16+
sourcemap: true
17+
},
18+
],
19+
external: [
20+
...Object.keys(pkg.dependencies || {})
21+
],
22+
plugins: [
23+
typescriptPlugin(),
24+
terser()
25+
]
26+
};
27+
28+
export default allBuilds;

src/index.ts

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// import { BigNumber, ethers } from 'ethers';
2+
3+
export class Alchemy {
4+
// static num(): BigNumber {
5+
// return ethers.BigNumber.from(42);
6+
// }
7+
static foo(): string {
8+
return 'hello';
9+
}
10+
}

tsconfig.json

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"compilerOptions": {
3+
"declaration": true,
4+
"outDir": "dist/types",
5+
"forceConsistentCasingInFileNames": true,
6+
"allowSyntheticDefaultImports": true,
7+
"downlevelIteration": true,
8+
"importHelpers": true,
9+
"noFallthroughCasesInSwitch": true,
10+
"noImplicitReturns": true,
11+
"noUnusedLocals": true,
12+
"noUnusedParameters": true,
13+
"strict": true,
14+
"moduleResolution": "node",
15+
"esModuleInterop": true,
16+
"sourceMap": true,
17+
"target": "es5",
18+
"typeRoots": [
19+
"node_modules/@types"
20+
]
21+
},
22+
"include": [
23+
"src/**/*"
24+
],
25+
"exclude": [
26+
"dist/**/*",
27+
"test/**/*"
28+
]
29+
}

0 commit comments

Comments
 (0)