-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add kintone-customize presets for flat config (#845)
- Loading branch information
Showing
15 changed files
with
157 additions
and
50 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
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,23 @@ | ||
const globals = require("globals"); | ||
const kintoneGlobals = require("../globals/kintone"); | ||
|
||
/** | ||
* @return { import("eslint").Linter.FlatConfig[] } | ||
*/ | ||
module.exports = function kintoneEs5() { | ||
return [ | ||
{ | ||
languageOptions: { | ||
ecmaVersion: 5, | ||
sourceType: "script", | ||
globals: { | ||
...globals.browser, | ||
...kintoneGlobals, | ||
}, | ||
}, | ||
rules: { | ||
strict: ["error", "function"], | ||
}, | ||
}, | ||
]; | ||
}; |
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,23 +1,16 @@ | ||
const globals = require("globals"); | ||
const kintoneGlobals = require("../globals/kintone"); | ||
const base = require("../lib/base.js"); | ||
|
||
/** | ||
* @return { import("eslint").Linter.FlatConfig[] } | ||
*/ | ||
module.exports = function kintone() { | ||
return [ | ||
{ | ||
languageOptions: { | ||
ecmaVersion: 5, | ||
sourceType: "script", | ||
globals: { | ||
...globals.browser, | ||
...kintoneGlobals, | ||
}, | ||
}, | ||
rules: { | ||
strict: ["error", "function"], | ||
}, | ||
return base({ | ||
overrideGlobals: { | ||
...globals.browser, | ||
...globals.es2024, | ||
...kintoneGlobals, | ||
}, | ||
]; | ||
}); | ||
}; |
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,14 +1,14 @@ | ||
const es5 = require("../lib/es5.js"); | ||
const kintone = require("../lib/kintone.js"); | ||
const prettier = require("../lib/prettier.js"); | ||
const kintoneEs5 = require("../lib/kintone-es5.js"); | ||
const kintoneGlobals = require("../globals/kintone.js"); | ||
const prettier = require("../lib/prettier.js"); | ||
|
||
/** | ||
* @type { import("eslint").Linter.Config[] } | ||
*/ | ||
module.exports = [ | ||
{ files: ["**/*.{js,cjs,mjs,jsx}"] }, | ||
...es5(kintoneGlobals), | ||
...kintone(), | ||
...es5({ overrideGlobals: kintoneGlobals }), | ||
...kintoneEs5(), | ||
...prettier(), | ||
]; |
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,8 +1,12 @@ | ||
const es5 = require("../lib/es5.js"); | ||
const kintone = require("../lib/kintone.js"); | ||
const kintoneEs5 = require("../lib/kintone-es5.js"); | ||
const kintoneGlobals = require("../globals/kintone.js"); | ||
|
||
/** | ||
* @type { import("eslint").Linter.Config[] } | ||
*/ | ||
module.exports = [...es5(kintoneGlobals), ...kintone()]; | ||
module.exports = [ | ||
{ files: ["**/*.{js,cjs,mjs,jsx}"] }, | ||
...es5({ overrideGlobals: kintoneGlobals }), | ||
...kintoneEs5(), | ||
]; |
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,11 @@ | ||
const kintone = require("../lib/kintone.js"); | ||
const prettier = require("../lib/prettier.js"); | ||
|
||
/** | ||
* @type { import("eslint").Linter.Config[] } | ||
*/ | ||
module.exports = [ | ||
{ files: ["**/*.{js,cjs,mjs,ts,mts,cts,jsx,tsx}"] }, | ||
...kintone(), | ||
...prettier(), | ||
]; |
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,9 @@ | ||
const kintone = require("../lib/kintone.js"); | ||
|
||
/** | ||
* @type { import("eslint").Linter.Config[] } | ||
*/ | ||
module.exports = [ | ||
{ files: ["**/*.{js,cjs,mjs,ts,mts,cts,jsx,tsx}"] }, | ||
...kintone(), | ||
]; |
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,26 @@ | ||
const assert = require("assert"); | ||
const kintoneEs5 = require("../../flat/lib/kintone-es5"); | ||
const runLintWithFixturesFlat = require("../lib/runLintWithFixturesFlat"); | ||
|
||
describe("flat kintone-es5", () => { | ||
it("should get expected errors and warnings with kintone-es5 config", async () => { | ||
const result = await runLintWithFixturesFlat("kintone", kintoneEs5()); | ||
assert.deepStrictEqual(result, { | ||
"error.js": { | ||
errors: ["strict", "strict"], | ||
}, | ||
"ok.js": {}, | ||
}); | ||
}); | ||
it("should be able to use kintone-customize-es5 as well as lib/kintone-es5", async () => { | ||
assert.deepStrictEqual( | ||
await runLintWithFixturesFlat("globals-kintone", kintoneEs5()), | ||
{ | ||
"ok.js": {}, | ||
"error.js": { | ||
errors: ["no-undef"], | ||
}, | ||
} | ||
); | ||
}); | ||
}); |
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,13 @@ | ||
const assert = require("assert"); | ||
const kintoneCustomizePrettier = require("../../flat/presets/kintone-customize-prettier"); | ||
const prettier = require("../../flat/presets/prettier"); | ||
const runLintWithFixturesFlat = require("../lib/runLintWithFixturesFlat"); | ||
|
||
describe("flat preset kintone-customize-prettier", () => { | ||
it("should be able to use kintone-customize as well as preset/prettier", async () => { | ||
assert.deepStrictEqual( | ||
await runLintWithFixturesFlat("prettier", prettier), | ||
await runLintWithFixturesFlat("prettier", kintoneCustomizePrettier) | ||
); | ||
}); | ||
}); |
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,28 @@ | ||
const assert = require("assert"); | ||
const kintoneCustomize = require("../../flat/presets/kintone-customize"); | ||
const base = require("../../flat/presets/base"); | ||
const runLintWithFixturesFlat = require("../lib/runLintWithFixturesFlat"); | ||
|
||
describe("flat preset kintone-customize", () => { | ||
it("should be able to use kintone-customize as well as preset/base", async () => { | ||
assert.deepStrictEqual( | ||
await runLintWithFixturesFlat("base", base), | ||
await runLintWithFixturesFlat("base", kintoneCustomize) | ||
); | ||
}); | ||
it("should get expected errors and warninigs with kintone globals", async () => { | ||
const result = await runLintWithFixturesFlat( | ||
"globals-kintone", | ||
kintoneCustomize | ||
); | ||
assert.deepStrictEqual(result, { | ||
"error.js": { | ||
errors: ["no-undef"], | ||
warnings: ["spaced-comment"], | ||
}, | ||
"ok.js": { | ||
warnings: ["spaced-comment"], | ||
}, | ||
}); | ||
}); | ||
}); |
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