implement phase 4
This commit is contained in:
parent
25c2ce53cd
commit
f4b1c3e14b
27 changed files with 6929 additions and 48 deletions
46
addin/eslint.config.mjs
Normal file
46
addin/eslint.config.mjs
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
import officeAddins from "eslint-plugin-office-addins";
|
||||
import tsParser from "@typescript-eslint/parser";
|
||||
import tsPlugin from "@typescript-eslint/eslint-plugin";
|
||||
import globals from "globals";
|
||||
|
||||
// สืบทอดจาก config เริ่มต้นของ office-addin-lint (node_modules/office-addin-lint/config/eslint.config.mjs)
|
||||
// — office-addin-lint จะใช้ไฟล์นี้แทนถ้ามีอยู่ใน root ของโปรเจกต์
|
||||
//
|
||||
// ปิด `no-navigational-load` เพราะ rule ของ plugin เวอร์ชันนี้ (4.0.10):
|
||||
// (a) crash กับ `context.load(obj)` แบบ 1 อาร์กิวเมนต์ (parsePropertiesArgument(undefined))
|
||||
// (b) ไม่รู้จัก Word API properties (เช่น `tag`) จึงรายงาน false positive
|
||||
export default [
|
||||
...officeAddins.configs.recommended,
|
||||
{
|
||||
plugins: {
|
||||
"office-addins": officeAddins,
|
||||
},
|
||||
languageOptions: {
|
||||
parser: tsParser,
|
||||
// task pane รันใน browser (Office) แต่ unit test/jest setup ใช้ node globals ด้วย
|
||||
globals: { ...globals.browser, ...globals.node, ...globals.jest },
|
||||
},
|
||||
},
|
||||
{
|
||||
rules: {
|
||||
"office-addins/no-navigational-load": "off",
|
||||
},
|
||||
},
|
||||
{
|
||||
// ไฟล์ TS: tsc ตรวจ undefined globals อยู่แล้ว (แม่นกว่า no-undef ที่ไม่เข้าใจ types)
|
||||
// และ no-redeclare ชนกับ /* global */ comments ของ scaffold
|
||||
files: ["**/*.ts", "**/*.tsx"],
|
||||
plugins: {
|
||||
"@typescript-eslint": tsPlugin,
|
||||
},
|
||||
rules: {
|
||||
"no-undef": "off",
|
||||
"no-redeclare": "off",
|
||||
"no-unused-vars": "off",
|
||||
"@typescript-eslint/no-unused-vars": [
|
||||
"error",
|
||||
{ argsIgnorePattern: "^_", varsIgnorePattern: "^_" },
|
||||
],
|
||||
},
|
||||
},
|
||||
];
|
||||
Loading…
Add table
Add a link
Reference in a new issue