Skip to content

Commit 14c0545

Browse files
jdtzmnonetechnical
andauthored
Establish code style and fix errors in existing codebase (algorand#299)
Co-authored-by: John Lee <[email protected]>
1 parent 05e45b9 commit 14c0545

File tree

111 files changed

+23595
-14123
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

111 files changed

+23595
-14123
lines changed

.editorconfig

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# top-most EditorConfig file
2+
root = true
3+
4+
# Unix-style newlines with a newline ending every file
5+
[*]
6+
end_of_line = lf
7+
insert_final_newline = true
8+
9+
# Set JavaScript file rules
10+
[*.js]
11+
charset = utf-8
12+
indent_style = space
13+
indent_size = 2
14+
15+
# Matches the exact files either package.json or .travis.yml
16+
[{package.json,.travis.yml}]
17+
indent_style = space
18+
indent_size = 2

.eslintrc.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
module.exports = {
2+
env: {
3+
browser: true,
4+
es2021: true,
5+
node: true,
6+
mocha: true,
7+
},
8+
extends: ['airbnb-base', 'prettier'],
9+
parser: '@typescript-eslint/parser',
10+
parserOptions: {
11+
ecmaVersion: 12,
12+
},
13+
plugins: ['@typescript-eslint'],
14+
rules: {
15+
'no-restricted-syntax': ['error', 'LabeledStatement', 'WithStatement'],
16+
'no-plusplus': ['error', { allowForLoopAfterthoughts: true }],
17+
'max-classes-per-file': 'off',
18+
},
19+
ignorePatterns: [
20+
'dist/',
21+
'tests/cucumber/features/',
22+
'tests/cucumber/build/',
23+
'tests/browser/bundle.*',
24+
],
25+
};

.gitignore

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
.DS_Store
22

33
.idea/
4-
.vscode
4+
.vscode/*
5+
!.vscode/settings.json
6+
!.vscode/extensions.json
57

68
# npm
79
node_modules/
@@ -16,3 +18,6 @@ examples/.env
1618
tests/cucumber/features/
1719
tests/cucumber/browser/build
1820
tests/browser/bundle.*
21+
22+
# Caches
23+
.eslintcache

.huskyrc.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module.exports = {
2+
hooks: {
3+
'pre-commit': 'lint-staged',
4+
},
5+
};

.lintstagedrc.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module.exports = {
2+
'*.{js,ts,md,json,yml}': 'prettier --write',
3+
'*.{js,ts}': 'eslint --cache --fix',
4+
};

.prettierignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
dist
2+
tests/cucumber/features
3+
tests/cucumber/browser/build
4+
tests/browser/bundle.*

.prettierrc.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"singleQuote": true
3+
}

.travis.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ dist: bionic
22
language: node_js
33

44
node_js:
5-
- "12"
5+
- '12'
66

77
script:
88
- set -e
@@ -12,6 +12,11 @@ script:
1212

1313
jobs:
1414
include:
15+
- stage: Code Style
16+
name: ESLint
17+
script: npm run lint
18+
- name: Prettier
19+
script: prettier --check .
1520
- stage: Testing
1621
name: Node test
1722
- name: Chrome test

.vscode/extensions.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"recommendations": ["esbenp.prettier-vscode", "dbaeumer.vscode-eslint"]
3+
}

.vscode/settings.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"editor.defaultFormatter": "esbenp.prettier-vscode",
3+
"editor.formatOnSave": true,
4+
"editor.formatOnPaste": true,
5+
"eslint.validate": ["typescript"]
6+
}

0 commit comments

Comments
 (0)