Skip to content

Commit fe995f0

Browse files
Merge pull request amejiarosario#2 from amejiarosario/eslint-fixes
Eslint fixes
2 parents 7a4172c + d86de1f commit fe995f0

38 files changed

+312
-240
lines changed

.eslintignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/runtimes/**
2+
src/data-structures/maps/hash-maps/hashing.js
3+
src/data-structures/maps/hash-maps/*-test.js
4+
src/data-structures/maps/hash-maps/hash-map-*.js
5+
src/data-structures/linked-lists/linked-list-*.js
6+
src/data-structures/custom/lru-cache-*.js

.eslintrc.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
module.exports = {
2-
"extends": "airbnb-base",
3-
"env": {
4-
"jest": true
2+
extends: 'airbnb-base',
3+
env: {
4+
jest: true
5+
},
6+
globals: {
7+
BigInt: true,
58
},
69
rules: {
710
// https://github.com/airbnb/javascript/issues/1089
811

912
// https://stackoverflow.com/a/35637900/684957
1013
// allow to add properties to arguments
11-
"no-param-reassign": [2, { "props": false }],
14+
'no-param-reassign': [2, { 'props': false }],
1215

1316
// https://eslint.org/docs/rules/no-plusplus
1417
// allows unary operators ++ and -- in the afterthought (final expression) of a for loop.
15-
"no-plusplus": [2, { "allowForLoopAfterthoughts": true }],
18+
'no-plusplus': [2, { 'allowForLoopAfterthoughts': true }],
1619

1720
// Allow for..of
18-
"no-restricted-syntax": [0, "ForOfStatement"],
19-
},
20-
globals: {
21-
BigInt: true,
21+
'no-restricted-syntax': [0, 'ForOfStatement'],
2222
}
2323
};

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
language: node_js
2+
script: npm run ci
23
node_js:
34
- "node"
45
- "lts/*"

.vscode/settings.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"workbench.colorCustomizations": {
3+
"titleBar.activeBackground": "#f9e64f",
4+
"titleBar.inactiveBackground": "#f9e64f99",
5+
"titleBar.activeForeground": "#15202b",
6+
"titleBar.inactiveForeground": "#15202b99"
7+
}
8+
}

src/changelog.md renamed to CHANGELOG.md

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,51 @@
11
# Changelog
2+
23
All notable changes to this project will be documented in this file.
34

45
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
56
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
67

78
## [Unreleased]
8-
### Changed
9-
- Fix picture on https://www.npmjs.com/package/dsa.js
10-
### Added
11-
- CI: travis
12-
### Removed
13-
-
9+
10+
### Breaking changes
11+
12+
### New Features
13+
- Added Eslint and Travis ci
14+
15+
### Patches
16+
- Readme improvements
17+
- Badges for npm versions and build status
1418

1519
## [1.1.0] - 2019-03-29
20+
1621
### Added
22+
1723
- README.md added because NPM packages doesn't read README.adoc
1824
- Public API to use the package `dsa.js`
1925
- This changelog
2026

2127
### Changed
28+
2229
- Updated dependencies (removed lodash since is not needed)
2330

2431
### Removed
32+
2533
-
2634

2735
## [1.0.0] - 2019-03-29
36+
2837
### Added
38+
2939
- Started the project
3040
- Book released
3141
- npm package published
3242

3343
### Changed
44+
3445
-
46+
3547
### Removed
48+
3649
-
3750

3851

README.md

Lines changed: 57 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,29 @@
11
# Data Structures and Algorithms in JavaScript
22

3+
[![Build Status](https://travis-ci.com/amejiarosario/dsa.js.svg?branch=master)](https://travis-ci.com/amejiarosario/dsa.js)
4+
[![npm version](https://badge.fury.io/js/dsa.js.svg)](https://badge.fury.io/js/dsa.js)
5+
36
This repository covers the implementation of the classical algorithms and data structures in JavaScript.
47

5-
8+
## Usage
9+
10+
You can clone the repo or install the code from NPM:
11+
12+
```sh
13+
npm install dsa.js
14+
```
15+
16+
and then you can import it into your programs or CLI
17+
18+
```js
19+
const { LinkedList, Queue, Stack } = require('dsa.js');
20+
```
21+
22+
For a full list of all the exposed data structures and algorithms [see](https://github.com/amejiarosario/dsa.js/blob/master/src/index.js).
623

724
## Book
825

9-
You can check out the book that goes deeper into each topic and provide addtional illustrations and explanations.
26+
You can check out the book that goes deeper into each topic and provide additional illustrations and explanations.
1027

1128
- Algorithmic toolbox to avoid getting stuck while coding.
1229
- Explains data structures similarities and differences.
@@ -21,65 +38,67 @@ We are covering the following data structures.
2138
[![Interactive Data Structures](https://user-images.githubusercontent.com/418605/46118890-ba721180-c1d6-11e8-82bc-6a671428b422.png)](https://embed.kumu.io/85f1a4de5fb8430a10a1bf9c5118e015)
2239

2340
### Linear Data Structures
24-
1. **Arrays**: Built-in in most languages so not implemented here.
41+
42+
1. **Arrays**: Built-in in most languages so not implemented here.
2543
[Post](https://adrianmejia.com/blog/2018/04/28/data-structures-time-complexity-for-beginners-arrays-hashmaps-linked-lists-stacks-queues-tutorial/#Array).
2644

27-
2. **Linked Lists**: each data node has a link to the next (and
45+
2. **Linked Lists**: each data node has a link to the next (and
2846
previous).
2947
[Code](https://github.com/amejiarosario/dsa.js/blob/master/src/data-structures/linked-lists/linked-list.js)
3048
|
3149
[Post](https://adrianmejia.com/blog/2018/04/28/data-structures-time-complexity-for-beginners-arrays-hashmaps-linked-lists-stacks-queues-tutorial/#Linked-Lists).
3250

33-
3. **Queue**: data flows in a "first-in, first-out" (FIFO) manner.
51+
3. **Queue**: data flows in a "first-in, first-out" (FIFO) manner.
3452
[Code](https://github.com/amejiarosario/dsa.js/blob/master/src/data-structures/queues/queue.js)
3553
|
3654
[Post](https://adrianmejia.com/blog/2018/04/28/data-structures-time-complexity-for-beginners-arrays-hashmaps-linked-lists-stacks-queues-tutorial/#Queues)
3755

38-
4. **Stacks**: data flows in a "last-in, first-out" (LIFO) manner.
56+
4. **Stacks**: data flows in a "last-in, first-out" (LIFO) manner.
3957
[Code](https://github.com/amejiarosario/dsa.js/blob/master/src/data-structures/stacks/stack.js)
4058
|
4159
[Post](https://adrianmejia.com/blog/2018/04/28/data-structures-time-complexity-for-beginners-arrays-hashmaps-linked-lists-stacks-queues-tutorial/#Stacks).
4260

4361
### Non-Linear Data Structures
44-
1. **Trees**: data nodes has zero or more adjacent nodes a.k.a.
62+
63+
1. **Trees**: data nodes has zero or more adjacent nodes a.k.a.
4564
children. Each node can only have one parent node otherwise is a
4665
graph not a tree.
4766
[Code](https://github.com/amejiarosario/algorithms.js/tree/master/src/data-structures/trees)
4867
|
4968
[Post](https://adrianmejia.com/blog/2018/06/11/data-structures-for-beginners-trees-binary-search-tree-tutorial/)
5069

51-
1. **Binary Trees**: same as tree but only can have two children at
70+
1. **Binary Trees**: same as tree but only can have two children at
5271
most.
5372
[Code](https://github.com/amejiarosario/algorithms.js/tree/master/src/data-structures/trees)
5473
|
5574
[Post](https://adrianmejia.com/blog/2018/06/11/data-structures-for-beginners-trees-binary-search-tree-tutorial/#Binary-Trees)
5675

57-
2. **Binary Search Trees** (BST): same as binary tree, but the
76+
2. **Binary Search Trees** (BST): same as binary tree, but the
5877
nodes value keep this order `left < parent < rigth`.
5978
[Code](https://github.com/amejiarosario/algorithms.js/blob/master/src/data-structures/trees/binary-search-tree.js)
6079
|
6180
[Post](https://adrianmejia.com/blog/2018/06/11/data-structures-for-beginners-trees-binary-search-tree-tutorial/#Binary-Search-Tree-BST)
6281

63-
3. **AVL Trees**: Self-balanced BST to maximize look up time.
82+
3. **AVL Trees**: Self-balanced BST to maximize look up time.
6483
[Code](https://github.com/amejiarosario/algorithms.js/blob/master/src/data-structures/trees/avl-tree.js)
6584
|
6685
[Post](https://adrianmejia.com/blog/2018/07/16/self-balanced-binary-search-trees-with-avl-tree-data-structure-for-beginners/)
6786

68-
4. **Red-Black Trees**: Self-balanced BST more loose than AVL to
87+
4. **Red-Black Trees**: Self-balanced BST more loose than AVL to
6988
maximize insertion speed.
7089
[Code](https://github.com/amejiarosario/algorithms.js/blob/master/src/data-structures/trees/red-black-tree.js)
7190

72-
2. **Maps**: key-value store.
91+
2. **Maps**: key-value store.
7392

74-
1. **Hash Maps**: implements map using a hash function.
93+
1. **Hash Maps**: implements map using a hash function.
7594
[Code](https://github.com/amejiarosario/algorithms.js/blob/master/src/data-structures/hash-maps/hashmap.js)
7695
|
7796
[Post](https://adrianmejia.com/blog/2018/04/28/data-structures-time-complexity-for-beginners-arrays-hashmaps-linked-lists-stacks-queues-tutorial/#HashMaps)
7897

79-
2. **Tree Maps**: implement map using a self-balanced BST.
98+
2. **Tree Maps**: implement map using a self-balanced BST.
8099
[Code](https://github.com/amejiarosario/dsa.js/blob/master/src/data-structures/maps/tree-maps/tree-map.js)
81100

82-
3. **Graphs**: data **nodes** that can have a connection or **edge** to
101+
3. **Graphs**: data **nodes** that can have a connection or **edge** to
83102
zero or more adjacent nodes. Unlike trees, nodes can have multiple
84103
parents, loops.
85104
[Code](https://github.com/amejiarosario/algorithms.js/blob/master/src/data-structures/graphs/graph.js)
@@ -88,39 +107,39 @@ We are covering the following data structures.
88107

89108
## Algorithms
90109

91-
- Sorting algorithms
110+
- Sorting algorithms
92111

93-
- Bubble Sort.
94-
[Code](https://github.com/amejiarosario/dsa.js/blob/master/src/algorithms/sorting/bubble-sort.js)
112+
- Bubble Sort.
113+
[Code](https://github.com/amejiarosario/dsa.js/blob/master/src/algorithms/sorting/bubble-sort.js)
95114

96-
- Insertion Sort.
97-
[Code](https://github.com/amejiarosario/dsa.js/blob/master/src/algorithms/sorting/insertion-sort.js)
115+
- Insertion Sort.
116+
[Code](https://github.com/amejiarosario/dsa.js/blob/master/src/algorithms/sorting/insertion-sort.js)
98117

99-
- Selection Sort.
100-
[Code](https://github.com/amejiarosario/dsa.js/blob/master/src/algorithms/sorting/selection-sort.js)
118+
- Selection Sort.
119+
[Code](https://github.com/amejiarosario/dsa.js/blob/master/src/algorithms/sorting/selection-sort.js)
101120

102-
- Merge Sort.
103-
[Code](https://github.com/amejiarosario/dsa.js/blob/master/src/algorithms/sorting/merge-sort.js)
121+
- Merge Sort.
122+
[Code](https://github.com/amejiarosario/dsa.js/blob/master/src/algorithms/sorting/merge-sort.js)
104123

105-
- Quicksort.
106-
[Code](https://github.com/amejiarosario/dsa.js/blob/master/src/algorithms/sorting/quick-sort.js)
124+
- Quick sort.
125+
[Code](https://github.com/amejiarosario/dsa.js/blob/master/src/algorithms/sorting/quick-sort.js)
107126

108-
- Greedy Algorithms
127+
- Greedy Algorithms
109128

110-
- Fractional Knapsack Problem.
111-
[Code](https://github.com/amejiarosario/dsa.js/blob/master/src/algorithms/knapsack-fractional.js)
129+
- Fractional Knapsack Problem.
130+
[Code](https://github.com/amejiarosario/dsa.js/blob/master/src/algorithms/knapsack-fractional.js)
112131

113-
- Divide and Conquer
132+
- Divide and Conquer
114133

115-
- Fibonacci Numbers.
116-
[Code](https://github.com/amejiarosario/dsa.js/blob/master/src/algorithms/fibonacci-recursive.js)
134+
- Fibonacci Numbers.
135+
[Code](https://github.com/amejiarosario/dsa.js/blob/master/src/algorithms/fibonacci-recursive.js)
117136

118-
- Dynamic Programming
137+
- Dynamic Programming
119138

120-
- Fibonacci with memoization.
121-
[Code](https://github.com/amejiarosario/dsa.js/blob/master/src/algorithms/fibanacci-dynamic-programming.js)
139+
- Fibonacci with memoization.
140+
[Code](https://github.com/amejiarosario/dsa.js/blob/master/src/algorithms/fibanacci-dynamic-programming.js)
122141

123-
- Backtracking algorithms
142+
- Backtracking algorithms
124143

125-
- Word permutations.
126-
[Code](https://github.com/amejiarosario/dsa.js/blob/master/src/algorithms/permutations-backtracking.js)
144+
- Word permutations.
145+
[Code](https://github.com/amejiarosario/dsa.js/blob/master/src/algorithms/permutations-backtracking.js)

README.adoc renamed to deprecated-README.adoc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
:toclevels: 2
44
Adrian Mejia <https://github.com/amejiarosario[@amejiarosario]>
55

6+
image:https://travis-ci.com/amejiarosario/dsa.js.svg?branch=master["Build Status", link="https://travis-ci.com/amejiarosario/dsa.js"]
7+
image:https://badge.fury.io/js/dsa.js.svg["npm version", link="https://badge.fury.io/js/dsa.js"]
8+
69
This repository covers the implementation of the classical algorithms and data structures in JavaScript.
710

811
toc::[]
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)