-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import core from "./dist/core.mjs"; | ||
import jest from "./dist/jest.mjs"; | ||
import jsxA11y from "./dist/jsx-a11y.mjs"; | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
bsokol-wl
Author
Contributor
|
||
import mdx from "./dist/mdx.mjs"; | ||
import react from "./dist/react.mjs"; | ||
import storybook from "./dist/storybook.mjs"; | ||
import testingLibrary from "./dist/testing-library.mjs"; | ||
import yml from "./dist/yaml.mjs"; | ||
|
||
const config = [ | ||
...core, | ||
jsxA11y, | ||
mdx, | ||
jest, | ||
...storybook, | ||
...react, | ||
yml, | ||
...testingLibrary | ||
]; | ||
|
||
// console.log(config); | ||
|
||
export default config; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,158 +1,156 @@ | ||
import js from "@eslint/js"; | ||
import type { Linter } from "eslint"; | ||
import importPlugin from "eslint-plugin-import"; | ||
import { sourceFiles } from "../utils/patterns"; | ||
|
||
const config: Linter.Config = { | ||
overrides: [ | ||
{ | ||
files: sourceFiles, | ||
plugins: ["import"], | ||
extends: [ | ||
"eslint:recommended" | ||
], | ||
parserOptions: { | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
bsokol-wl
Author
Contributor
|
||
sourceType: "module", | ||
ecmaVersion: "latest" | ||
}, | ||
env: { | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
bsokol-wl
Author
Contributor
|
||
es2024: true, | ||
node: true, | ||
commonjs: true | ||
}, | ||
rules: { | ||
// eslint:recommended overwrite some rules | ||
"no-cond-assign": ["error", "except-parens"], | ||
"no-labels": ["warn", { allowLoop: true, allowSwitch: false }], | ||
"no-prototype-builtins": "off", | ||
const config: Linter.FlatConfig[] = [ | ||
{ | ||
files: sourceFiles, | ||
rules: { | ||
...js.configs.recommended.rules, | ||
// eslint:recommended overwrite some rules | ||
"no-cond-assign": ["error", "except-parens"], | ||
"no-labels": ["warn", { allowLoop: true, allowSwitch: false }], | ||
"no-prototype-builtins": "off", | ||
|
||
// https://eslint.org/docs/rules | ||
// Extra eslint rules | ||
// https://eslint.org/docs/rules | ||
// Extra eslint rules | ||
|
||
// Possible Problems | ||
"array-callback-return": "error", | ||
"no-self-compare": "error", | ||
"no-template-curly-in-string": "error", | ||
"no-use-before-define": [ | ||
"error", | ||
{ | ||
functions: false, | ||
classes: false, | ||
variables: false | ||
} | ||
], | ||
// Possible Problems | ||
"array-callback-return": "error", | ||
"no-self-compare": "error", | ||
"no-template-curly-in-string": "error", | ||
"no-use-before-define": [ | ||
"error", | ||
{ | ||
functions: false, | ||
classes: false, | ||
variables: false | ||
} | ||
], | ||
|
||
// Suggestions | ||
"no-array-constructor": "warn", | ||
"no-caller": "warn", | ||
"no-eval": "warn", | ||
"no-extend-native": "warn", | ||
"no-extra-bind": "warn", | ||
"no-extra-label": "warn", | ||
"no-implied-eval": "warn", | ||
"no-iterator": "warn", | ||
"no-label-var": "warn", | ||
"no-lone-blocks": "warn", | ||
"no-loop-func": "warn", | ||
"no-multi-str": "warn", | ||
"no-new-func": "warn", | ||
"no-new-object": "warn", | ||
"no-new-wrappers": "warn", | ||
"no-octal-escape": "warn", | ||
"no-useless-computed-key": "warn", | ||
"no-useless-concat": "warn", | ||
"no-useless-constructor": "warn", | ||
"no-script-url": "warn", | ||
"no-sequences": "warn", | ||
"no-throw-literal": "warn", | ||
"prefer-const": "warn", | ||
"no-var": "warn", | ||
"curly": "warn", | ||
"no-shadow": "warn", | ||
"no-restricted-properties": "warn", | ||
"no-unneeded-ternary": "warn", | ||
"no-param-reassign": "warn", | ||
"eqeqeq": ["warn", "smart"], | ||
"no-mixed-operators": [ | ||
"warn", | ||
{ | ||
groups: [ | ||
["&", "|", "^", "~", "<<", ">>", ">>>"], | ||
["==", "!=", "===", "!==", ">", ">=", "<", "<="], | ||
["&&", "||"], | ||
["in", "instanceof"] | ||
], | ||
allowSamePrecedence: false | ||
} | ||
], | ||
"no-restricted-syntax": ["error", "WithStatement"], | ||
"no-restricted-globals": ["error"], | ||
"no-useless-rename": [ | ||
"warn", | ||
{ | ||
ignoreDestructuring: false, | ||
ignoreImport: false, | ||
ignoreExport: false | ||
} | ||
], | ||
"strict": ["warn", "never"], | ||
"no-unused-expressions": [ | ||
"error", | ||
{ | ||
allowShortCircuit: true, | ||
allowTernary: true, | ||
allowTaggedTemplates: true | ||
} | ||
], | ||
// Suggestions | ||
"no-array-constructor": "warn", | ||
"no-caller": "warn", | ||
"no-eval": "warn", | ||
"no-extend-native": "warn", | ||
"no-extra-bind": "warn", | ||
"no-extra-label": "warn", | ||
"no-implied-eval": "warn", | ||
"no-iterator": "warn", | ||
"no-label-var": "warn", | ||
"no-lone-blocks": "warn", | ||
"no-loop-func": "warn", | ||
"no-multi-str": "warn", | ||
"no-new-func": "warn", | ||
"no-new-object": "warn", | ||
"no-new-wrappers": "warn", | ||
"no-octal-escape": "warn", | ||
"no-useless-computed-key": "warn", | ||
"no-useless-concat": "warn", | ||
"no-useless-constructor": "warn", | ||
"no-script-url": "warn", | ||
"no-sequences": "warn", | ||
"no-throw-literal": "warn", | ||
"prefer-const": "warn", | ||
"no-var": "warn", | ||
"curly": "warn", | ||
"no-shadow": "warn", | ||
"no-restricted-properties": "warn", | ||
"no-unneeded-ternary": "warn", | ||
"no-param-reassign": "warn", | ||
"eqeqeq": ["warn", "smart"], | ||
"no-mixed-operators": [ | ||
"warn", | ||
{ | ||
groups: [ | ||
["&", "|", "^", "~", "<<", ">>", ">>>"], | ||
["==", "!=", "===", "!==", ">", ">=", "<", "<="], | ||
["&&", "||"], | ||
["in", "instanceof"] | ||
], | ||
allowSamePrecedence: false | ||
} | ||
], | ||
"no-restricted-syntax": ["error", "WithStatement"], | ||
"no-restricted-globals": ["error"], | ||
"no-useless-rename": [ | ||
"warn", | ||
{ | ||
ignoreDestructuring: false, | ||
ignoreImport: false, | ||
ignoreExport: false | ||
} | ||
], | ||
"strict": ["warn", "never"], | ||
"no-unused-expressions": [ | ||
"error", | ||
{ | ||
allowShortCircuit: true, | ||
allowTernary: true, | ||
allowTaggedTemplates: true | ||
} | ||
], | ||
|
||
// Layout & Formatting | ||
"no-native-reassign": "warn", // deprecated replaced by no-global-assign, deja ds recommended | ||
"no-negated-in-lhs": "warn", // deprecated replaced by no-unsafe-negation, deja ds recommended | ||
"padding-line-between-statements": [ | ||
"warn", | ||
{ blankLine: "always", prev: "*", next: "return" } | ||
], | ||
// Layout & Formatting | ||
"no-native-reassign": "warn", // deprecated replaced by no-global-assign, deja ds recommended | ||
"no-negated-in-lhs": "warn", // deprecated replaced by no-unsafe-negation, deja ds recommended | ||
"padding-line-between-statements": [ | ||
"warn", | ||
{ blankLine: "always", prev: "*", next: "return" } | ||
], | ||
|
||
"rest-spread-spacing": ["warn", "never"], | ||
"unicode-bom": ["warn", "never"], | ||
"comma-spacing": ["warn", { "before": false, "after": true }], | ||
"keyword-spacing": ["warn", { before: true, after: true }], | ||
"arrow-spacing": ["warn", { before: true, after: true }], | ||
"space-before-blocks": ["warn", "always"], | ||
"space-in-parens": ["warn", "never"], | ||
"padded-blocks": ["warn", "never"], | ||
"brace-style":["warn", "1tbs", { "allowSingleLine": true }], | ||
"new-parens": "warn", | ||
"no-whitespace-before-property": "warn", | ||
"no-multi-spaces": "warn", | ||
"no-multiple-empty-lines": "warn", | ||
"space-infix-ops": "warn", | ||
"max-len": ["warn", { tabWidth: 4, code: 300 }], | ||
"indent": [ | ||
"warn", | ||
4, | ||
{ | ||
SwitchCase: 1, | ||
CallExpression: { arguments: "first" } | ||
} | ||
], | ||
"semi": ["warn", "always"], | ||
"quotes": ["warn", "double"], | ||
"comma-dangle": ["warn", "never"], | ||
"object-curly-spacing": ["warn", "always"], | ||
"dot-location": ["warn", "property"], | ||
"arrow-parens": ["warn", "as-needed"], | ||
"rest-spread-spacing": ["warn", "never"], | ||
"unicode-bom": ["warn", "never"], | ||
"comma-spacing": ["warn", { "before": false, "after": true }], | ||
"keyword-spacing": ["warn", { before: true, after: true }], | ||
"arrow-spacing": ["warn", { before: true, after: true }], | ||
"space-before-blocks": ["warn", "always"], | ||
"space-in-parens": ["warn", "never"], | ||
"padded-blocks": ["warn", "never"], | ||
"brace-style":["warn", "1tbs", { "allowSingleLine": true }], | ||
"new-parens": "warn", | ||
"no-whitespace-before-property": "warn", | ||
"no-multi-spaces": "warn", | ||
"no-multiple-empty-lines": "warn", | ||
"space-infix-ops": "warn", | ||
"max-len": ["warn", { tabWidth: 4, code: 300 }], | ||
"indent": [ | ||
"warn", | ||
4, | ||
{ | ||
SwitchCase: 1, | ||
CallExpression: { arguments: "first" } | ||
} | ||
], | ||
"semi": ["warn", "always"], | ||
"quotes": ["warn", "double"], | ||
"comma-dangle": ["warn", "never"], | ||
"object-curly-spacing": ["warn", "always"], | ||
"dot-location": ["warn", "property"], | ||
"arrow-parens": ["warn", "as-needed"] | ||
|
||
// https://github.com/import-js/eslint-plugin-import/tree/main/docs/rules | ||
"import/no-amd": "error", | ||
"import/no-webpack-loader-syntax": "error", | ||
"import/no-self-import": "error", | ||
"import/newline-after-import" : "warn", | ||
"import/no-duplicates": "warn" | ||
} | ||
}, | ||
{ | ||
files: sourceFiles, | ||
plugins: { import: importPlugin }, | ||
// These settings should be temporary until the import plugin is updated | ||
// https://github.com/import-js/eslint-plugin-import/issues/2556 | ||
settings: { | ||
"import/parsers": { | ||
espree: [".js", ".cjs", ".mjs", ".jsx"] | ||
} | ||
}, | ||
rules: { | ||
// https://github.com/import-js/eslint-plugin-import/tree/main/docs/rules | ||
"import/no-amd": "error", | ||
"import/no-webpack-loader-syntax": "error", | ||
"import/no-self-import": "error", | ||
"import/newline-after-import" : "warn", | ||
"import/no-duplicates": "warn" | ||
} | ||
] | ||
}; | ||
} | ||
]; | ||
|
||
// 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; | ||
export default config; | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
bsokol-wl
Author
Contributor
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,17 @@ | ||
import jestPlugin from 'eslint-plugin-jest'; | ||
import { reactTestFiles, testFiles } from "../utils/patterns"; | ||
|
||
import type { Linter } from "eslint"; | ||
|
||
const config: Linter.Config = { | ||
overrides: [ | ||
{ | ||
files: [...testFiles, ...reactTestFiles], | ||
plugins: ["jest"], | ||
env: { | ||
es2024: true, | ||
node: true, | ||
browser: true, | ||
commonjs: true, | ||
jest: true | ||
}, | ||
extends: ["plugin:jest/recommended"], | ||
rules: { | ||
// Prefer spies to allow for automatic restoration | ||
"jest/prefer-spy-on": "error", | ||
// Gives better failure messages for array checks | ||
"jest/prefer-to-contain": "error" | ||
} | ||
} | ||
] | ||
}; | ||
const config: Linter.FlatConfig = { | ||
files: [...testFiles, ...reactTestFiles], | ||
...jestPlugin.configs['flat/recommended'], | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong. |
||
rules: { | ||
// Prefer spies to allow for automatic restoration | ||
"jest/prefer-spy-on": "error", | ||
// Gives better failure messages for array checks | ||
"jest/prefer-to-contain": "error" | ||
} | ||
} | ||
|
||
// 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; | ||
export default config; |
Is there a specific reason why this cannot continue to be an
index.js
file at the root of thelib
folder?We used this structure because it was the recommanded structure for ESLint plugin at the time. Did it changed?