diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 0000000..378eac2 --- /dev/null +++ b/.eslintignore @@ -0,0 +1 @@ +build diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 0000000..cca10f5 --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,5 @@ +{ + "extends": [ + "plugin:adonis/typescriptPackage" + ] +} diff --git a/package.json b/package.json index 22bf96a..1081bf5 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "mrm": "mrm --preset=@adonisjs/mrm-preset", "pretest": "npm run lint", "test": "node japaFile.js", - "lint": "tslint --project tsconfig.json", + "lint": "eslint . --ext=.ts", "clean": "del build", "compile": "npm run lint && npm run clean && tsc", "build": "npm run compile && typedoc --theme markdown --excludePrivate --hideSources && git add docs", @@ -35,23 +35,23 @@ }, "homepage": "https://github.com/poppinss/prompts#readme", "devDependencies": { - "@adonisjs/mrm-preset": "^2.1.0", - "@types/node": "^12.12.7", + "@adonisjs/mrm-preset": "^2.2.3", + "@types/node": "^12.12.21", "commitizen": "^4.0.3", "cz-conventional-changelog": "^3.0.2", "del-cli": "^3.0.0", "doctoc": "^1.4.0", - "husky": "^3.0.9", + "eslint": "^6.7.2", + "eslint-plugin-adonis": "^1.0.4", + "husky": "^3.1.0", "japa": "^3.0.1", - "mrm": "^1.2.2", - "np": "^5.1.3", - "ts-node": "^8.4.1", - "tslint": "^5.20.1", - "tslint-eslint-rules": "^5.4.0", - "typedoc": "^0.15.0", + "mrm": "^2.0.2", + "np": "^5.2.1", + "ts-node": "^8.5.4", + "typedoc": "^0.15.5", "typedoc-plugin-external-module-name": "^2.1.0", - "typedoc-plugin-markdown": "^2.2.11", - "typescript": "^3.7.2" + "typedoc-plugin-markdown": "^2.2.14", + "typescript": "^3.7.3" }, "nyc": { "exclude": [ diff --git a/test/prompt.spec.ts b/test/prompt.spec.ts index 75ed3ae..c90d251 100644 --- a/test/prompt.spec.ts +++ b/test/prompt.spec.ts @@ -14,9 +14,9 @@ test.group('Prompts | input', () => { test('test input prompt', async (assert) => { const prompt = new EmitterPrompt() - prompt.on('prompt', (prompt) => { - assert.equal(prompt.name, 'prompt') - prompt.answer('virk') + prompt.on('prompt', (question) => { + assert.equal(question.name, 'prompt') + question.answer('virk') }) const username = await prompt.ask('What\'s your username?') @@ -27,8 +27,8 @@ test.group('Prompts | input', () => { assert.plan(2) const prompt = new EmitterPrompt() - prompt.on('prompt', (prompt) => { - prompt.answer('') + prompt.on('prompt', (question) => { + question.answer('') }) prompt.on('prompt:error', (message) => { @@ -48,8 +48,8 @@ test.group('Prompts | input', () => { test('invoke result function before returning the result', async (assert) => { const prompt = new EmitterPrompt() - prompt.on('prompt', (prompt) => { - prompt.answer('virk') + prompt.on('prompt', (question) => { + question.answer('virk') }) const username = await prompt.ask('What\'s your username?', { @@ -67,8 +67,8 @@ test.group('Prompts | choice', () => { test('test choice prompt', async (assert) => { const prompt = new EmitterPrompt() - prompt.on('prompt', (prompt) => { - prompt.select(0) + prompt.on('prompt', (question) => { + question.select(0) }) const client = await prompt.choice('Select the installation client', ['npm', 'yarn']) @@ -79,8 +79,8 @@ test.group('Prompts | choice', () => { assert.plan(2) const prompt = new EmitterPrompt() - prompt.on('prompt', (prompt) => { - prompt.answer('') + prompt.on('prompt', (question) => { + question.answer('') }) prompt.on('prompt:error', (message) => { @@ -99,8 +99,8 @@ test.group('Prompts | choice', () => { test('invoke result function before returning the value', async (assert) => { const prompt = new EmitterPrompt() - prompt.on('prompt', (prompt) => { - prompt.select(0) + prompt.on('prompt', (question) => { + question.select(0) }) const client = await prompt.choice('Select the installation client', ['npm', 'yarn'], { @@ -117,8 +117,8 @@ test.group('Prompts | multiple', () => { test('test multiple prompt', async (assert) => { const prompt = new EmitterPrompt() - prompt.on('prompt', (prompt) => { - prompt.select(0) + prompt.on('prompt', (question) => { + question.select(0) }) const clients = await prompt.multiple('Select the installation client', ['npm', 'yarn']) @@ -129,8 +129,8 @@ test.group('Prompts | multiple', () => { assert.plan(2) const prompt = new EmitterPrompt() - prompt.on('prompt', (prompt) => { - prompt.answer([]) + prompt.on('prompt', (question) => { + question.answer([]) }) prompt.on('prompt:error', (message) => { @@ -149,8 +149,8 @@ test.group('Prompts | multiple', () => { test('invoke result function before returning the value', async (assert) => { const prompt = new EmitterPrompt() - prompt.on('prompt', (prompt) => { - prompt.select(0) + prompt.on('prompt', (question) => { + question.select(0) }) const clients = await prompt.multiple('Select the installation client', ['npm', 'yarn'], { @@ -166,8 +166,8 @@ test.group('Prompts | multiple', () => { test.group('Prompts | toggle', () => { test('test toggle prompt', async (assert) => { const prompt = new EmitterPrompt() - prompt.on('prompt', (prompt) => { - prompt.accept() + prompt.on('prompt', (question) => { + question.accept() }) const deleteFile = await prompt.toggle('Delete the file?', ['Yep', 'Nope']) @@ -178,8 +178,8 @@ test.group('Prompts | toggle', () => { assert.plan(2) const prompt = new EmitterPrompt() - prompt.on('prompt', (prompt) => { - prompt.decline() + prompt.on('prompt', (question) => { + question.decline() }) prompt.on('prompt:error', (message) => { @@ -197,8 +197,8 @@ test.group('Prompts | toggle', () => { test('invoke result function before returning the value', async (assert) => { const prompt = new EmitterPrompt() - prompt.on('prompt', (prompt) => { - prompt.accept() + prompt.on('prompt', (question) => { + question.accept() }) const deleteFile = await prompt.toggle('Delete the file?', ['Yep', 'Nope'], { @@ -213,8 +213,8 @@ test.group('Prompts | toggle', () => { test.group('Prompts | confirm', () => { test('test confirm prompt', async (assert) => { const prompt = new EmitterPrompt() - prompt.on('prompt', (prompt) => { - prompt.accept() + prompt.on('prompt', (question) => { + question.accept() }) const deleteFile = await prompt.confirm('Delete the file?') @@ -225,8 +225,8 @@ test.group('Prompts | confirm', () => { assert.plan(2) const prompt = new EmitterPrompt() - prompt.on('prompt', (prompt) => { - prompt.decline() + prompt.on('prompt', (question) => { + question.decline() }) prompt.on('prompt:error', (message) => { @@ -244,8 +244,8 @@ test.group('Prompts | confirm', () => { test('invoke result function before returning the value', async (assert) => { const prompt = new EmitterPrompt() - prompt.on('prompt', (prompt) => { - prompt.accept() + prompt.on('prompt', (question) => { + question.accept() }) const deleteFile = await prompt.confirm('Delete the file?', { @@ -260,8 +260,8 @@ test.group('Prompts | confirm', () => { test.group('Prompts | secure', () => { test('test secure prompt', async (assert) => { const prompt = new EmitterPrompt() - prompt.on('prompt', (prompt) => { - prompt.answer('foo') + prompt.on('prompt', (question) => { + question.answer('foo') }) const password = await prompt.secure('Enter password') @@ -272,8 +272,8 @@ test.group('Prompts | secure', () => { assert.plan(2) const prompt = new EmitterPrompt() - prompt.on('prompt', (prompt) => { - prompt.answer('') + prompt.on('prompt', (question) => { + question.answer('') }) prompt.on('prompt:error', (message) => { @@ -291,8 +291,8 @@ test.group('Prompts | secure', () => { test('invoke result function before returning the value', async (assert) => { const prompt = new EmitterPrompt() - prompt.on('prompt', (prompt) => { - prompt.answer('foo') + prompt.on('prompt', (question) => { + question.answer('foo') }) const password = await prompt.secure('Enter password', { diff --git a/tslint.json b/tslint.json deleted file mode 100644 index 5f51f2a..0000000 --- a/tslint.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "extends": [ - "@adonisjs/mrm-preset/_tslint" - ], - "rules": {} -}