Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add linting and formatting #2

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.DS_Store
node_modules
/dist

# package lockfile
# (if you run into package version conflicts later, unignore this)
yarn.lock

# log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dist
5 changes: 5 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"endOfLine": "auto",
"printWidth": 100,
"trailingComma": "es5"
}
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

### Added

-
- Linting and formatting via ESLint and Prettier

### Fixed

Expand Down
15 changes: 7 additions & 8 deletions bin/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#!/usr/bin/env node
ohheyjosh marked this conversation as resolved.
Show resolved Hide resolved

const word = require('../index')
import word from "../index.js";

function writeToConsole(output) {
process.stdout.clearLine();
Expand All @@ -11,11 +10,11 @@ function writeToConsole(output) {
console.log("Choosing a word for you...");

(async function demo() {
for (let i = 0; i < 500; i++) {
await new Promise(resolve => setTimeout(resolve, 5));
let spinner = ["/ ", "—", "\\ ", "| "]
output = spinner[i % 4] + word()
for (let i = 0; i < 500; i += 1) {
// eslint-disable-next-line no-await-in-loop
await new Promise((resolve) => setTimeout(resolve, 5));
const spinner = ["/ ", "—", "\\ ", "| "];
const output = spinner[i % 4] + word();
writeToConsole(output);
}
})().then( () => writeToConsole("=> " + word() + "\n") );

})().then(() => writeToConsole(`=> ${word()}\n`));
61 changes: 58 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,62 @@
const WORDS = ["psychotic", "pneumatic", "phonetic", "Pacific", "prosthetic", "pandemic", "pathetic", "pleonastic", "pedantic", "prognostic", "pleuritic", "piratic", "plethoric", "polemic", "phlegmatic", "pancreatic", "presbyopic", "pyknotic", "priapic", "phonemic", "pelagic", "puristic", "pragmatic", "pyretic", "plutonic", "pneumonic", "paretic", "pharisaic", "politic", "pantheistic", "Pharaonic", "Paleozoic", "pyloric", "platonic", "polaric", "plasmic", "prophetic", "prolific", "Potomac", "panoptic", "Puranic", "prodromic", "planktonic", "phyletic", "phenolic", "prostatic", "pilgarlic", "phrenetic", "podagric", "pulmonic", "panini", "Panera", "Pandora", "pandemonium"]
const WORDS = [
"psychotic",
"pneumatic",
"phonetic",
"Pacific",
"prosthetic",
"pandemic",
"pathetic",
"pleonastic",
"pedantic",
"prognostic",
"pleuritic",
"piratic",
"plethoric",
"polemic",
"phlegmatic",
"pancreatic",
"presbyopic",
"pyknotic",
"priapic",
"phonemic",
"pelagic",
"puristic",
"pragmatic",
"pyretic",
"plutonic",
"pneumonic",
"paretic",
"pharisaic",
"politic",
"pantheistic",
"Pharaonic",
"Paleozoic",
"pyloric",
"platonic",
"polaric",
"plasmic",
"prophetic",
"prolific",
"Potomac",
"panoptic",
"Puranic",
"prodromic",
"planktonic",
"phyletic",
"phenolic",
"prostatic",
"pilgarlic",
"phrenetic",
"podagric",
"pulmonic",
"panini",
"Panera",
"Pandora",
"pandemonium",
];

function word() {
return WORDS[Math.floor(Math.random() * WORDS.length)]
return WORDS[Math.floor(Math.random() * WORDS.length)];
}

module.exports = word
export default word;
27 changes: 27 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"repository": {
"url": "https://github.com/thecodepixi/pandera"
},
"type": "module",
"contributors": [
"Emily Harber",
"Yechiel Kalmenson"
Expand All @@ -17,5 +18,31 @@
},
"bin": {
"pandera": "bin/index.js"
},
"eslintConfig": {
"root": true,
"env": {
"node": true
},
"extends": [
"airbnb-base",
"plugin:prettier/recommended"
],
"ignorePatterns": "node_modules/*.js",
"rules": {
"no-unused-vars": "warn",
"import/extensions": "disable"
},
"settings": {
"usePrettierrc": true
}
},
"devDependencies": {
"eslint": "^7.25.0",
"eslint-config-airbnb-base": "^14.2.1",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-prettier": "^3.4.0",
"prettier": "^2.2.1"
}
}