-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1231 from gsoft-inc/feature/eslint-config
feat(eslint-plugin): Created an eslint plugin to add rules and configuration
- Loading branch information
Showing
21 changed files
with
1,549 additions
and
70 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,5 @@ | ||
--- | ||
"@orbit-ui/eslint-plugin": major | ||
--- | ||
|
||
Initial release of the orbit-ui eslint plugin |
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
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
Empty file.
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 @@ | ||
import type { Config } from "jest"; | ||
import { swcConfig } from "./swc.jest"; | ||
|
||
const config: Config = { | ||
testEnvironment: "node", | ||
transform: { | ||
"^.+\\.(js|ts)$": ["@swc/jest", swcConfig as Record<string, unknown>] | ||
} | ||
}; | ||
|
||
export default config; |
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,86 @@ | ||
import type { Linter } from "eslint"; | ||
import { sourceFiles } from "../utils/patterns"; | ||
|
||
const config: Linter.Config = { | ||
overrides: [ | ||
{ | ||
files: sourceFiles, | ||
plugins: ["jsx-a11y"], | ||
parserOptions: { | ||
ecmaFeatures: { | ||
jsx: true | ||
} | ||
}, | ||
rules: { | ||
// This rule ensures that all labels have an associated control that they are labeling. | ||
// However, this rule causes a lot of false positive, since our current implementation of our company's design system | ||
// does not use the "for" attribute in the label element and automatically add it inside Fields. | ||
// Therefore, we are disabling this rule. | ||
"jsx-a11y/label-has-associated-control:": "off" | ||
}, | ||
settings: { | ||
"jsx-a11y": { | ||
components: { | ||
// HTML Components Wrappers | ||
"A":"a", | ||
"Address":"address", | ||
"Article":"article", | ||
"HtmlButton":"button", | ||
"Div":"div", | ||
"HtmlFooter":"footer", | ||
"HtmlForm":"form", | ||
"HtmlH1":"h1", | ||
"HtmlH2":"h2", | ||
"HtmlH3":"h3", | ||
"HtmlH4":"h4", | ||
"HtmlH5":"h5", | ||
"HtmlH6":"h6", | ||
"HtmlHeader":"header", | ||
"Img":"img", | ||
"HtmlInput":"input", | ||
"HtmlLabel":"label", | ||
"LI":"li", | ||
"Main":"main", | ||
"Nav":"nav", | ||
"OL":"ol", | ||
"HtmlParagraph":"p", | ||
"HtmlSection":"section", | ||
"Span":"span", | ||
"Table":"table", | ||
"TBody":"tbody", | ||
"TD":"td", | ||
"HtmlTextArea":"textarea", | ||
"TFoot":"tfoot", | ||
"TH":"th", | ||
"THead":"thead", | ||
"TR":"tr", | ||
"UL":"ul", | ||
|
||
// Orbit components that are simple HTML element wrappers and behave like html elements | ||
Label : "label", | ||
Link : "a", | ||
TextLink : "a", | ||
IconLink : "a", | ||
TileLink : "a", | ||
Paragraph : "p", | ||
Text: "span", | ||
|
||
// Orbit components that are basically Divs synthax shortcuts and behave like html elements | ||
Flex : "div", | ||
Grid : "div", | ||
Inline : "div", | ||
Stack : "div", | ||
ThemeProvider : "div", | ||
Divider : "div", | ||
Transition : "div" | ||
} | ||
} | ||
} | ||
} | ||
] | ||
}; | ||
|
||
// Using TypeScript "export" keyword until ESLint support ESM. | ||
// Otherwise we must deal with a weird CommonJS output from esbuild which is not worth it. | ||
// For more info, see: https://github.com/evanw/esbuild/issues/1079 | ||
export = config; |
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 type { Linter } from "eslint"; | ||
|
||
const config: Linter.Config = { | ||
plugins: ["@orbit-ui"], | ||
extends: [ | ||
"plugin:@orbit-ui/jsx-a11y" | ||
] | ||
|
||
}; | ||
|
||
// Using TypeScript "export" keyword until ESLint support ESM. | ||
// Otherwise we must deal with a weird CommonJS output from esbuild which is not worth it. | ||
// For more info, see: https://github.com/evanw/esbuild/issues/1079 | ||
export = config; |
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 type { ESLint } from "eslint"; | ||
|
||
const plugin: ESLint.Plugin = { | ||
configs: { | ||
// Parts | ||
recommended: require("./config/recommended"), | ||
"jsx-a11y": require("./config/jsx-a11y") | ||
} | ||
}; | ||
|
||
// Using TypeScript "export" keyword until ESLint support ESM. | ||
// Otherwise we must deal with a weird CommonJS output from esbuild which is not worth it. | ||
// For more info, see: https://github.com/evanw/esbuild/issues/1079 | ||
export = plugin; |
Empty file.
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,4 @@ | ||
export const sourceFiles = [ | ||
"*.[jt]s?(x)", | ||
"*.[cm]js" | ||
]; |
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,64 @@ | ||
{ | ||
"name": "@orbit-ui/eslint-plugin", | ||
"author": "Workleap", | ||
"description": "Workleap recommended ESLint rules and configurations when using Orbit.", | ||
"version": "0.0.1", | ||
"keywords": [ | ||
"workleap", | ||
"eslint", | ||
"eslintconfig", | ||
"eslintplugin", | ||
"eslint-config", | ||
"eslint-plugin" | ||
], | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/gsoft-inc/sg-orbit.git", | ||
"directory": "tooling/eslint-plugin" | ||
}, | ||
"license": "Apache-2.0", | ||
"exports": { | ||
".": { | ||
"require": "./dist/index.js", | ||
"import": "./dist/index.js", | ||
"types": "./dist/index.d.ts" | ||
} | ||
}, | ||
"types": "./dist/index.d.ts", | ||
"files": [ | ||
"docs", | ||
"dist", | ||
"CHANGELOG.md", | ||
"README.md" | ||
], | ||
"scripts": { | ||
"build": "tsup" | ||
}, | ||
"dependencies": { | ||
"eslint-plugin-jsx-a11y": "^6.7.1" | ||
}, | ||
"peerDependencies": { | ||
"eslint": "*" | ||
}, | ||
"devDependencies": { | ||
"@swc/core": "1.3.85", | ||
"@swc/helpers": "0.5.2", | ||
"@swc/jest": "0.2.29", | ||
"@types/eslint": "8.44.2", | ||
"@types/estree": "1.0.1", | ||
"@types/jest": "29.5.5", | ||
"@types/node": "20.6.2", | ||
"@workleap/swc-configs": "2.1.2", | ||
"@workleap/tsup-configs": "3.0.1", | ||
"@workleap/typescript-configs": "3.0.2", | ||
"eslint": "8.49.0", | ||
"jest": "29.7.0", | ||
"ts-node": "10.9.1", | ||
"tsup": "7.2.0", | ||
"typescript": "5.2.2" | ||
}, | ||
"publishConfig": { | ||
"access": "public", | ||
"provenance": true | ||
} | ||
} |
Oops, something went wrong.