Skip to content

Commit

Permalink
Enable some import rules
Browse files Browse the repository at this point in the history
  • Loading branch information
fregante committed Dec 11, 2021
1 parent e98bb12 commit 2a5d6bc
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// These are rules that apply this to repo, they're not exported. Ignore.

const localConfig = require("./server.js");

localConfig.rules = {
...localConfig.rules,
"filenames/match-exported": "off",
Expand Down
22 changes: 19 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const config = {
version: "detect",
},
},
plugins: ["filenames", "jsx-a11y"],
plugins: ["filenames", "jsx-a11y", "import"],
extends: [
"xo", // Full config: https://github.com/xojs/eslint-config-xo/blob/main/index.js
"xo-typescript", // Full config: https://github.com/xojs/eslint-config-xo-typescript/blob/main/index.js
Expand Down Expand Up @@ -56,7 +56,6 @@ const config = {
],
},
],

"no-mixed-operators": [
"error",
{
Expand All @@ -73,6 +72,24 @@ const config = {
},
],

// Add some import rules
"import/no-absolute-path": "error",
"import/no-anonymous-default-export": "error",
"import/no-named-default": "error",
"import/no-webpack-loader-syntax": "error",
"import/no-self-import": "error",
"import/no-cycle": [
"warn",
{
ignoreExternal: true,
},
],
"import/no-useless-path-segments": "error",
"import/newline-after-import": "error",
"import/no-extraneous-dependencies": "error",
"import/no-named-as-default-member": "error",
"import/no-named-as-default": "error",

// Customize some rules
quotes: ["error", "double", { avoidEscape: true }], // Matches Prettier, but also replaces backticks
"unicorn/prefer-export-from": [
Expand Down Expand Up @@ -117,7 +134,6 @@ const config = {
// Disable recommended rules
// It's fine because eqeqeq covers it. See https://github.com/pixiebrix/pixiebrix-extension/pull/887#pullrequestreview-711873690
"no-eq-null": "off",
"import/named": "off", // TypeScript does this natively
"import/no-unresolved": "off", // TypeScript does this natively
"react/prop-types": "off",
"unicorn/prefer-node-protocol": "off", // Not fully supported by TS
Expand Down
1 change: 1 addition & 0 deletions server.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
module.exports = require("./index.js");

module.exports.rules = {
...module.exports.rules,
// Allow CJS because not all tooling is ready
Expand Down

0 comments on commit 2a5d6bc

Please sign in to comment.