Skip to content

Commit e241383

Browse files
tejasbubanematthewmorgan
authored andcommitted
Get ESLint rolling (#479)
* Prefer default export in eslint rules * Add eslint to make test Which eventually is run by travis. Along with an eslintignore file for all exercises. We will fix and enable eslint for each exercise. * Upgrade eslint and remove unwanted eslint packages eslint `jsx` and `react` packages are not required. * Use airbnb-base instead of airbnb package Since this is a plain JS repo (no react/JSX) - base is what we need. * Fix hello-world exercise for eslint To avoid fatal error on no files found: https://eslint.org/docs/5.0.0/user-guide/migrating-to-5.0.0#nonexistent-files In the process also change `hello-world` to not use `class`.
1 parent d35f659 commit e241383

File tree

106 files changed

+1444
-1353
lines changed

Some content is hidden

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

106 files changed

+1444
-1353
lines changed

.eslintignore

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
accumulate
2+
acronym
3+
all-your-base
4+
allergies
5+
alphametics
6+
anagram
7+
armstrong-numbers
8+
atbash-cipher
9+
beer-song
10+
binary
11+
binary-search
12+
binary-search-tree
13+
bob
14+
bowling
15+
bracket-push
16+
change
17+
circular-buffer
18+
clock
19+
collatz-conjecture
20+
complex-numbers
21+
connect
22+
crypto-square
23+
custom-set
24+
diamond
25+
difference-of-squares
26+
diffie-hellman
27+
etl
28+
flatten-array
29+
food-chain
30+
forth
31+
gigasecond
32+
grade-school
33+
grains
34+
hamming
35+
hexadecimal
36+
house
37+
isbn-verifier
38+
isogram
39+
kindergarten-garden
40+
largest-series-product
41+
leap
42+
linked-list
43+
list-ops
44+
luhn
45+
matrix
46+
meetup
47+
minesweeper
48+
nth-prime
49+
nucleotide-count
50+
ocr-numbers
51+
octal
52+
palindrome-products
53+
pangram
54+
pascals-triangle
55+
perfect-numbers
56+
phone-number
57+
pig-latin
58+
point-mutations
59+
prime-factors
60+
protein-translation
61+
proverb
62+
pythagorean-triplet
63+
queen-attack
64+
raindrops
65+
rational-numbers
66+
react
67+
rectangles
68+
reverse-string
69+
rna-transcription
70+
robot-name
71+
robot-simulator
72+
roman-numerals
73+
rotational-cipher
74+
run-length-encoding
75+
saddle-points
76+
say
77+
scrabble-score
78+
secret-handshake
79+
series
80+
sieve
81+
simple-cipher
82+
simple-linked-list
83+
space-age
84+
spiral-matrix
85+
strain
86+
sublist
87+
sum-of-multiples
88+
transpose
89+
triangle
90+
trinary
91+
twelve-days
92+
two-bucket
93+
two-fer
94+
variable-length-quantity
95+
word-count
96+
word-search
97+
wordy
98+
zipper

Makefile

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,15 @@ test-travis:
3636
@for pkg in $(PKG_FILES); do \
3737
! ./bin/md5-hash $$pkg | grep -qv $(SOURCE_PKG_MD5) || { echo "$$pkg does not match main package.json. Please run 'make test' locally and commit the results."; exit 1; }; \
3838
done
39-
@echo "Preparing tests..."
40-
@for assignment in $(ASSIGNMENTS); do ASSIGNMENT=$$assignment $(MAKE) -s copy-assignment || exit 1; done
41-
@node_modules/.bin/jest --bail $(OUTDIR)
42-
@rm -rf $(OUTDIR)
39+
$(MAKE) -s test
4340

4441
test:
4542
@echo "Preparing tests..."
46-
@for assignment in $(ASSIGNMENTS); do ASSIGNMENT=$$assignment $(MAKE) -s copy-assignment || exit 1; node_modules/.bin/jest --bail $(OUTDIR); rm -rf $(OUTDIR); done
43+
@for assignment in $(ASSIGNMENTS); do \
44+
ASSIGNMENT=$$assignment $(MAKE) -s copy-assignment || exit 1; \
45+
done
46+
@echo "Checking eslint..."
47+
@node_modules/.bin/eslint $(OUTDIR);
48+
@echo "Running tests..."
49+
@node_modules/.bin/jest --bail $(OUTDIR);
50+
rm -rf $(OUTDIR);

exercises/accumulate/package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,9 @@
1212
"babel-jest": "^21.2.0",
1313
"babel-plugin-transform-builtin-extend": "^1.1.2",
1414
"babel-preset-env": "^1.4.0",
15-
"eslint": "^3.19.0",
16-
"eslint-config-airbnb": "^15.0.1",
17-
"eslint-plugin-import": "^2.2.0",
18-
"eslint-plugin-jsx-a11y": "^5.0.1",
19-
"eslint-plugin-react": "^7.0.1",
15+
"eslint": "^5.6.0",
16+
"eslint-config-airbnb-base": "^13.1.0",
17+
"eslint-plugin-import": "^2.14.0",
2018
"jest": "^21.2.1"
2119
},
2220
"jest": {
@@ -67,10 +65,12 @@
6765
"node": true,
6866
"jest": true
6967
},
70-
"extends": "airbnb",
68+
"extends": "airbnb-base",
7169
"rules": {
7270
"import/no-unresolved": "off",
73-
"import/extensions": "off"
71+
"import/extensions": "off",
72+
"import/prefer-default-export": "off",
73+
"import/no-default-export": "off"
7474
}
7575
},
7676
"licenses": [

exercises/acronym/package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,9 @@
1212
"babel-jest": "^21.2.0",
1313
"babel-plugin-transform-builtin-extend": "^1.1.2",
1414
"babel-preset-env": "^1.4.0",
15-
"eslint": "^3.19.0",
16-
"eslint-config-airbnb": "^15.0.1",
17-
"eslint-plugin-import": "^2.2.0",
18-
"eslint-plugin-jsx-a11y": "^5.0.1",
19-
"eslint-plugin-react": "^7.0.1",
15+
"eslint": "^5.6.0",
16+
"eslint-config-airbnb-base": "^13.1.0",
17+
"eslint-plugin-import": "^2.14.0",
2018
"jest": "^21.2.1"
2119
},
2220
"jest": {
@@ -67,10 +65,12 @@
6765
"node": true,
6866
"jest": true
6967
},
70-
"extends": "airbnb",
68+
"extends": "airbnb-base",
7169
"rules": {
7270
"import/no-unresolved": "off",
73-
"import/extensions": "off"
71+
"import/extensions": "off",
72+
"import/prefer-default-export": "off",
73+
"import/no-default-export": "off"
7474
}
7575
},
7676
"licenses": [

exercises/all-your-base/package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,9 @@
1212
"babel-jest": "^21.2.0",
1313
"babel-plugin-transform-builtin-extend": "^1.1.2",
1414
"babel-preset-env": "^1.4.0",
15-
"eslint": "^3.19.0",
16-
"eslint-config-airbnb": "^15.0.1",
17-
"eslint-plugin-import": "^2.2.0",
18-
"eslint-plugin-jsx-a11y": "^5.0.1",
19-
"eslint-plugin-react": "^7.0.1",
15+
"eslint": "^5.6.0",
16+
"eslint-config-airbnb-base": "^13.1.0",
17+
"eslint-plugin-import": "^2.14.0",
2018
"jest": "^21.2.1"
2119
},
2220
"jest": {
@@ -67,10 +65,12 @@
6765
"node": true,
6866
"jest": true
6967
},
70-
"extends": "airbnb",
68+
"extends": "airbnb-base",
7169
"rules": {
7270
"import/no-unresolved": "off",
73-
"import/extensions": "off"
71+
"import/extensions": "off",
72+
"import/prefer-default-export": "off",
73+
"import/no-default-export": "off"
7474
}
7575
},
7676
"licenses": [

exercises/allergies/package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,9 @@
1212
"babel-jest": "^21.2.0",
1313
"babel-plugin-transform-builtin-extend": "^1.1.2",
1414
"babel-preset-env": "^1.4.0",
15-
"eslint": "^3.19.0",
16-
"eslint-config-airbnb": "^15.0.1",
17-
"eslint-plugin-import": "^2.2.0",
18-
"eslint-plugin-jsx-a11y": "^5.0.1",
19-
"eslint-plugin-react": "^7.0.1",
15+
"eslint": "^5.6.0",
16+
"eslint-config-airbnb-base": "^13.1.0",
17+
"eslint-plugin-import": "^2.14.0",
2018
"jest": "^21.2.1"
2119
},
2220
"jest": {
@@ -67,10 +65,12 @@
6765
"node": true,
6866
"jest": true
6967
},
70-
"extends": "airbnb",
68+
"extends": "airbnb-base",
7169
"rules": {
7270
"import/no-unresolved": "off",
73-
"import/extensions": "off"
71+
"import/extensions": "off",
72+
"import/prefer-default-export": "off",
73+
"import/no-default-export": "off"
7474
}
7575
},
7676
"licenses": [

exercises/alphametics/package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,9 @@
1212
"babel-jest": "^21.2.0",
1313
"babel-plugin-transform-builtin-extend": "^1.1.2",
1414
"babel-preset-env": "^1.4.0",
15-
"eslint": "^3.19.0",
16-
"eslint-config-airbnb": "^15.0.1",
17-
"eslint-plugin-import": "^2.2.0",
18-
"eslint-plugin-jsx-a11y": "^5.0.1",
19-
"eslint-plugin-react": "^7.0.1",
15+
"eslint": "^5.6.0",
16+
"eslint-config-airbnb-base": "^13.1.0",
17+
"eslint-plugin-import": "^2.14.0",
2018
"jest": "^21.2.1"
2119
},
2220
"jest": {
@@ -67,10 +65,12 @@
6765
"node": true,
6866
"jest": true
6967
},
70-
"extends": "airbnb",
68+
"extends": "airbnb-base",
7169
"rules": {
7270
"import/no-unresolved": "off",
73-
"import/extensions": "off"
71+
"import/extensions": "off",
72+
"import/prefer-default-export": "off",
73+
"import/no-default-export": "off"
7474
}
7575
},
7676
"licenses": [

exercises/anagram/package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,9 @@
1212
"babel-jest": "^21.2.0",
1313
"babel-plugin-transform-builtin-extend": "^1.1.2",
1414
"babel-preset-env": "^1.4.0",
15-
"eslint": "^3.19.0",
16-
"eslint-config-airbnb": "^15.0.1",
17-
"eslint-plugin-import": "^2.2.0",
18-
"eslint-plugin-jsx-a11y": "^5.0.1",
19-
"eslint-plugin-react": "^7.0.1",
15+
"eslint": "^5.6.0",
16+
"eslint-config-airbnb-base": "^13.1.0",
17+
"eslint-plugin-import": "^2.14.0",
2018
"jest": "^21.2.1"
2119
},
2220
"jest": {
@@ -67,10 +65,12 @@
6765
"node": true,
6866
"jest": true
6967
},
70-
"extends": "airbnb",
68+
"extends": "airbnb-base",
7169
"rules": {
7270
"import/no-unresolved": "off",
73-
"import/extensions": "off"
71+
"import/extensions": "off",
72+
"import/prefer-default-export": "off",
73+
"import/no-default-export": "off"
7474
}
7575
},
7676
"licenses": [

exercises/armstrong-numbers/package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,9 @@
1212
"babel-jest": "^21.2.0",
1313
"babel-plugin-transform-builtin-extend": "^1.1.2",
1414
"babel-preset-env": "^1.4.0",
15-
"eslint": "^3.19.0",
16-
"eslint-config-airbnb": "^15.0.1",
17-
"eslint-plugin-import": "^2.2.0",
18-
"eslint-plugin-jsx-a11y": "^5.0.1",
19-
"eslint-plugin-react": "^7.0.1",
15+
"eslint": "^5.6.0",
16+
"eslint-config-airbnb-base": "^13.1.0",
17+
"eslint-plugin-import": "^2.14.0",
2018
"jest": "^21.2.1"
2119
},
2220
"jest": {
@@ -67,10 +65,12 @@
6765
"node": true,
6866
"jest": true
6967
},
70-
"extends": "airbnb",
68+
"extends": "airbnb-base",
7169
"rules": {
7270
"import/no-unresolved": "off",
73-
"import/extensions": "off"
71+
"import/extensions": "off",
72+
"import/prefer-default-export": "off",
73+
"import/no-default-export": "off"
7474
}
7575
},
7676
"licenses": [

exercises/atbash-cipher/package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,9 @@
1212
"babel-jest": "^21.2.0",
1313
"babel-plugin-transform-builtin-extend": "^1.1.2",
1414
"babel-preset-env": "^1.4.0",
15-
"eslint": "^3.19.0",
16-
"eslint-config-airbnb": "^15.0.1",
17-
"eslint-plugin-import": "^2.2.0",
18-
"eslint-plugin-jsx-a11y": "^5.0.1",
19-
"eslint-plugin-react": "^7.0.1",
15+
"eslint": "^5.6.0",
16+
"eslint-config-airbnb-base": "^13.1.0",
17+
"eslint-plugin-import": "^2.14.0",
2018
"jest": "^21.2.1"
2119
},
2220
"jest": {
@@ -67,10 +65,12 @@
6765
"node": true,
6866
"jest": true
6967
},
70-
"extends": "airbnb",
68+
"extends": "airbnb-base",
7169
"rules": {
7270
"import/no-unresolved": "off",
73-
"import/extensions": "off"
71+
"import/extensions": "off",
72+
"import/prefer-default-export": "off",
73+
"import/no-default-export": "off"
7474
}
7575
},
7676
"licenses": [

0 commit comments

Comments
 (0)