-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into release-canary
- Loading branch information
Showing
15 changed files
with
520 additions
and
110 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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
"eslint-plugin-rtl-friendly": minor | ||
--- | ||
|
||
Add option `allowPhysicalInsetWithAbsolute` to allow the use of `left-1/2` with `fixed -translate-x-1/2` | ||
|
||
Add option `debug` |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,14 @@ | ||
import { describe, expect, it } from "vitest"; | ||
import { recommended } from "./recommended.js"; | ||
|
||
describe("recommended", () => { | ||
it("should export recommended", () => { | ||
expect(recommended).toMatchInlineSnapshot(` | ||
{ | ||
"rules": { | ||
"rtl-friendly/no-physical-properties": "warn", | ||
}, | ||
} | ||
`); | ||
}); | ||
}); |
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,7 @@ | ||
/** | ||
* Act as default options for rules | ||
*/ | ||
export const FLAGS = { | ||
allowPhysicalInsetWithAbsolute: false, | ||
debug: false, | ||
}; |
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,55 @@ | ||
import { describe, it, expect, expectTypeOf } from "vitest"; | ||
import rtlFriendly, { ruleSettings } from "./index.js"; | ||
import { name, version } from "../package.json"; | ||
import type { Rule } from "./rules/no-phyisical-properties/rule.js"; | ||
|
||
// useless tests generated by copilot :) | ||
|
||
describe("rtlFriendly", () => { | ||
it("should have correct meta information", () => { | ||
expect(rtlFriendly.meta.name).toBe(name); | ||
expect(rtlFriendly.meta.version).toBe(version); | ||
}); | ||
|
||
it("should have the no-physical-properties rule", () => { | ||
expect(rtlFriendly.rules).toHaveProperty("no-physical-properties"); | ||
expectTypeOf( | ||
rtlFriendly.rules["no-physical-properties"] | ||
).toMatchTypeOf<Rule>(); | ||
}); | ||
|
||
describe("configs", () => { | ||
it("should have a recommended config", () => { | ||
expect(rtlFriendly.configs).toHaveProperty("recommended"); | ||
}); | ||
|
||
it("recommended config should have the correct rules", () => { | ||
expect(rtlFriendly.configs.recommended.rules).toHaveProperty( | ||
"rtl-friendly/no-physical-properties", | ||
"warn" | ||
); | ||
}); | ||
|
||
it("recommended config should include the rtlFriendly plugin", () => { | ||
expect(rtlFriendly.configs.recommended.plugins).toHaveProperty( | ||
"rtl-friendly", | ||
rtlFriendly | ||
); | ||
}); | ||
|
||
it("recommended config should have jsx enabled in parser options", () => { | ||
expect( | ||
rtlFriendly.configs.recommended.languageOptions?.parserOptions | ||
?.ecmaFeatures?.jsx | ||
).toBe(true); | ||
}); | ||
}); | ||
}); | ||
|
||
describe("ruleSettings", () => { | ||
it("should return the options", () => { | ||
expect(ruleSettings({ allowPhysicalInsetWithAbsolute: true })).toEqual({ | ||
allowPhysicalInsetWithAbsolute: true, | ||
}); | ||
}); | ||
}); |
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,20 @@ | ||
// the ast.ts exports are tested in `test.ts` but this file is only to 100% coverage | ||
|
||
import { describe, expect, it } from "vitest"; | ||
import { extractTokensFromNode } from "./ast.js"; | ||
import type { Context } from "./rule.js"; | ||
import type { AST_NODE_TYPES, TSESTree } from "@typescript-eslint/utils"; | ||
|
||
describe("ast", () => { | ||
it("non JSXAttribute", () => { | ||
expect( | ||
extractTokensFromNode( | ||
{ | ||
type: "VariableDeclaration" as AST_NODE_TYPES.VariableDeclaration, | ||
} as TSESTree.Node, | ||
{} as Context, | ||
"fixer" | ||
) | ||
).toEqual([]); | ||
}); | ||
}); |
Oops, something went wrong.