Skip to content

Commit

Permalink
setup rollup, prettier, eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
thebrianchen committed Mar 23, 2022
1 parent a486ed5 commit c78b01e
Show file tree
Hide file tree
Showing 9 changed files with 2,660 additions and 0 deletions.
51 changes: 51 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
module.exports = {
plugins: [
'import',
'unused-imports',
'@typescript-eslint'
],
parser: '@typescript-eslint/parser',
parserOptions: {
'ecmaVersion': 2017,
'sourceType': 'module',
'project': './tsconfig.json'
},
rules: {
'curly': ['error', 'all'],
'no-extra-label': 'error',
'no-unused-labels': 'error',
'new-parens': 'error',
'no-new-wrappers': 'error',
'no-debugger': 'error',
'no-duplicate-case': 'error',
'no-throw-literal': 'error',
'no-return-await': 'error',
'no-unsafe-finally': 'error',
'no-unused-expressions': [
'error',
{
'allowShortCircuit': true
}
],
'no-var': 'error',
'object-shorthand': 'error',
'prefer-arrow-callback': [
'error',
{
'allowNamedFunctions': true
}
],
'prefer-const': [
'error',
{
'destructuring': 'all'
}
],
'no-array-constructor': 'error',
'import/no-default-export': 'error',
'import/no-duplicates': 'error',
'unused-imports/no-unused-imports-ts': 'error',
'default-case': 'error',
'@typescript-eslint/no-floating-promises': 'error'
}
};
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Mac OS
.DS_Store

# Yarn
node_modules
yarn-error.log
yarn-debug.log

dist
Empty file added .npmignore
Empty file.
6 changes: 6 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"singleQuote": true,
"printWidth": 80,
"trailingComma": "none",
"arrowParens": "avoid"
}
67 changes: 67 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
{
"name": "exploring-pioneer",
"version": "1.0.0",
"description": "",
"author": "",
"license": "MIT",
"scripts": {
"prebuild": "tsc --emitDeclarationOnly --declaration -p tsconfig.json",
"build": "rollup -c",
"clean": "rm -rf dist",
"lint": "eslint -c .eslintrc.js '**/*.ts' --ignore-path '.gitignore'",
"prettier": "prettier --write",
"test": "test"
},
"main": "dist/index.cjs.js",
"module": "dist/index.esm.js",
"exports": {
"node": {
"require": "./dist/index.cjs.js",
"import": "./dist/index.esm.js"
},
"default": "./dist/index.esm.js"
},
"types": "./dist/types/index.d.ts",
"repository": {
"type": "git",
"url": "git+https://github.com/alchemyplatform/exploring-pioneer.git"
},
"files": [
"dist"
],
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"**/*.ts": [
"yarn lint",
"yarn prettier",
"git add"
]
},
"bugs": {
"url": "https://github.com/alchemyplatform/exploring-pioneer/issues"
},
"homepage": "https://github.com/alchemyplatform/exploring-pioneer#readme",
"dependencies": {
"axios": "^0.26.1",
"ethers": "^5.6.1",
"tslib": "^2.3.1"
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^5.16.0",
"@typescript-eslint/parser": "^5.16.0",
"eslint": "^8.11.0",
"eslint-plugin-import": "^2.25.4",
"eslint-plugin-unused-imports": "^2.0.0",
"husky": "^7.0.4",
"lint-staged": "^12.3.7",
"prettier": "2.6.0",
"rollup": "^2.70.1",
"rollup-plugin-terser": "^7.0.2",
"rollup-plugin-typescript2": "^0.31.2",
"typescript": "^4.6.2"
}
}
28 changes: 28 additions & 0 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import pkg from './package.json';
import typescriptPlugin from 'rollup-plugin-typescript2';
import { terser } from 'rollup-plugin-terser';

const allBuilds = {
input: 'src/index.ts',
output: [
{
file: pkg.main,
format: 'cjs',
sourcemap: true
},
{
file: pkg.module,
format: 'esm',
sourcemap: true
},
],
external: [
...Object.keys(pkg.dependencies || {})
],
plugins: [
typescriptPlugin(),
terser()
]
};

export default allBuilds;
10 changes: 10 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// import { BigNumber, ethers } from 'ethers';

export class Alchemy {
// static num(): BigNumber {
// return ethers.BigNumber.from(42);
// }
static foo(): string {
return 'hello';
}
}
29 changes: 29 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"compilerOptions": {
"declaration": true,
"outDir": "dist/types",
"forceConsistentCasingInFileNames": true,
"allowSyntheticDefaultImports": true,
"downlevelIteration": true,
"importHelpers": true,
"noFallthroughCasesInSwitch": true,
"noImplicitReturns": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"strict": true,
"moduleResolution": "node",
"esModuleInterop": true,
"sourceMap": true,
"target": "es5",
"typeRoots": [
"node_modules/@types"
]
},
"include": [
"src/**/*"
],
"exclude": [
"dist/**/*",
"test/**/*"
]
}
Loading

0 comments on commit c78b01e

Please sign in to comment.