1
1
mirror of https://github.com/theoludwig/eslint-config-conventions.git synced 2025-05-18 12:02:33 +02:00

chore: initial commit

This commit is contained in:
Divlo
2022-02-19 16:05:21 +01:00
commit b79a5fbcb0
38 changed files with 17334 additions and 0 deletions

15
test/basic.js Normal file
View File

@@ -0,0 +1,15 @@
const test = require('tape')
const config = require('../index.js')
test('test basic properties of config', function (t) {
t.ok(isObject(config.parserOptions))
t.ok(isObject(config.env))
t.ok(isObject(config.rules))
t.ok(isObject(config.overrides))
t.end()
})
function isObject(object) {
return typeof object === 'object' && object !== null
}

5
test/fixtures/javascript-no-errors.js vendored Normal file
View File

@@ -0,0 +1,5 @@
const foo = 1
const bar = (argument) => {
return argument + foo
}
bar(foo)

View File

@@ -0,0 +1 @@
'invalid eqeqeq' == 'invalid eqeqeq'

3
test/fixtures/top-level-await.mjs vendored Normal file
View File

@@ -0,0 +1,3 @@
const foo = await 1
const bar = function () {}
await bar(foo)

5
test/fixtures/typescript-no-errors.ts vendored Normal file
View File

@@ -0,0 +1,5 @@
const foo = 1
const bar = (argument: number): number => {
return argument + foo
}
bar(foo)

View File

@@ -0,0 +1,5 @@
const foo = 1
const bar = (argument: number) => {
return argument + foo
}
bar(foo)

37
test/validate-config.js Normal file
View File

@@ -0,0 +1,37 @@
const { ESLint } = require('eslint')
const test = require('tape')
test('ensure we validate correctly JavaScript files', async (t) => {
const eslint = new ESLint({ ignore: false })
const [noErrors] = await eslint.lintFiles(
'test/fixtures/javascript-no-errors.js'
)
const [withErrors] = await eslint.lintFiles(
'test/fixtures/javascript-with-errors.js'
)
t.equal(noErrors.errorCount, 0)
t.equal(withErrors.errorCount, 3)
t.end()
})
test('ensure we validate correctly TypeScript files', async (t) => {
const eslint = new ESLint({ ignore: false })
const [noErrors] = await eslint.lintFiles(
'test/fixtures/typescript-no-errors.ts'
)
const [withErrors] = await eslint.lintFiles(
'test/fixtures/javascript-with-errors.js'
)
t.equal(noErrors.errorCount, 0)
t.equal(withErrors.errorCount, 3)
t.end()
})
test('ensure we allow top-level await', async (t) => {
const eslint = new ESLint({ ignore: false })
const [lintResult] = await eslint.lintFiles(
'test/fixtures/top-level-await.mjs'
)
t.equal(lintResult.errorCount, 0)
t.end()
})