-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tested and fixed importing/using recommended config.
- Loading branch information
Josh Wilson
committed
Sep 17, 2021
1 parent
7c28cbc
commit eded332
Showing
7 changed files
with
75 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
dist | ||
node_modules | ||
node_modules | ||
/test/fixture |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import execa from "execa"; | ||
import path from "path"; | ||
import assert from "assert"; | ||
import fs from "fs/promises"; | ||
|
||
const nodeModulesFileForTesting = path.resolve( | ||
__dirname, | ||
"..", | ||
"node_modules", | ||
"eslint-plugin-solid.js" | ||
); | ||
|
||
const fixtureCwd = path.resolve(__dirname, "fixture"); | ||
|
||
// We can't use `yarn bin` because it uses the eslint-v6 bin | ||
const eslintPath = require.resolve("eslint/bin/eslint.js"); | ||
|
||
describe("fixture", function () { | ||
this.slow(500); | ||
|
||
before(async () => { | ||
// We're trying to require the package we're currently in; we can work around | ||
// this by putting a skeleton file inside `node_modules` that requires the top | ||
// level directory. | ||
await fs.writeFile(nodeModulesFileForTesting, `module.exports = require("..");\n`); | ||
}); | ||
|
||
after(async () => { | ||
await fs.unlink(nodeModulesFileForTesting); | ||
}); | ||
|
||
it("loads the plugin without crashing", async () => { | ||
const { exitCode } = await execa.node(eslintPath, ["--print-config", "super-simple.js"], { | ||
cwd: fixtureCwd, | ||
}); | ||
assert.strictEqual(exitCode, 0); | ||
}); | ||
|
||
it("produces reasonable lint errors", async () => { | ||
try { | ||
await execa.node(eslintPath, ["super-simple.js"], { | ||
cwd: fixtureCwd, | ||
}); | ||
} catch (error) { | ||
assert.strictEqual(error.exitCode, 1); | ||
assert.match(error.stdout, /'Component' is not defined/); | ||
assert.match(error.stdout, /solid\/jsx-no-undef/); | ||
assert.match(error.stdout, /1 problem \(1 error, 0 warnings\)/); | ||
} | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"root": true, | ||
"extends": "plugin:solid/recommended", | ||
"plugins": ["solid"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
let el = <Component />; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters