-
Notifications
You must be signed in to change notification settings - Fork 1
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 #24 from atom-community/folderize
- Loading branch information
Showing
20 changed files
with
226 additions
and
183 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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{ | ||
"extends": ".", | ||
"extends": "./strict", | ||
"ignorePatterns": ["dist/", "node_modules/"] | ||
} |
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 |
---|---|---|
@@ -1,133 +1 @@ | ||
const pluginNodeRules = { | ||
"node/no-exports-assign": "error", | ||
"node/process-exit-as-throw": "error", | ||
"node/shebang": "error", | ||
"node/no-deprecated-api": "error", | ||
"node/prefer-promises/dns": "error", | ||
"node/prefer-promises/fs": "error", | ||
} | ||
|
||
const pluginImportExtraRules = { | ||
"import/no-absolute-path": "error", | ||
"import/no-useless-path-segments": "error", | ||
"import/no-deprecated": "error", | ||
"import/no-extraneous-dependencies": "error", | ||
"import/no-unassigned-import": "warn", | ||
"import/no-mutable-exports": "warn", | ||
"import/no-anonymous-default-export": "error", | ||
"import/no-amd": "error", | ||
//// might be too restrictive: | ||
// "import/no-commonjs": "warn", | ||
// "import/no-dynamic-require": "warn", // prevent abusing dynamic require | ||
//// don't work properly: | ||
// "import/unambiguous": "error", | ||
// "import/no-unused-modules": ["warn", {"missingExports": true}], | ||
} | ||
|
||
module.exports = { | ||
// JS Files | ||
root: true, | ||
env: { | ||
atomtest: true, | ||
es6: true, | ||
node: true, | ||
browser: true, | ||
jasmine: true, | ||
}, | ||
globals: { | ||
atom: "readonly", | ||
measure: "readonly", | ||
}, | ||
parser: "babel-eslint", | ||
parserOptions: { | ||
ecmaFeatures: { | ||
jsx: true, | ||
}, | ||
ecmaVersion: 2021, | ||
sourceType: "module", | ||
}, | ||
plugins: ["node", "import", "only-warn"], | ||
extends: ["eslint:recommended", "plugin:optimize-regex/all", "plugin:import/recommended", "prettier"], | ||
ignorePatterns: ["node_modules/"], | ||
rules: { | ||
...pluginNodeRules, | ||
...pluginImportExtraRules, | ||
}, | ||
overrides: [ | ||
{ | ||
// Bundled node version with atom has an old ESLint | ||
// TypeScript files | ||
files: ["**/*.ts", "**/*.tsx"], | ||
parser: "@typescript-eslint/parser", | ||
plugins: ["@typescript-eslint", "node", "import", "only-warn"], | ||
extends: [ | ||
"eslint:recommended", | ||
"plugin:@typescript-eslint/eslint-recommended", | ||
"plugin:@typescript-eslint/recommended", | ||
"plugin:optimize-regex/all", | ||
"plugin:import/recommended", | ||
"prettier", | ||
], | ||
rules: { | ||
"@typescript-eslint/explicit-function-return-type": "off", | ||
"@typescript-eslint/explicit-module-boundary-types": "off", | ||
"@typescript-eslint/camelcase": "off", | ||
"@typescript-eslint/no-use-before-define": "off", | ||
"@typescript-eslint/member-delimiter-style": "off", | ||
"@typescript-eslint/no-inferrable-types": "off", | ||
"@typescript-eslint/no-non-null-assertion": "off", | ||
...pluginNodeRules, | ||
...pluginImportExtraRules, | ||
// Buggy on TypeScript: | ||
"import/no-unresolved": "off", | ||
"import/named": "off", | ||
"import/namespace": "off", | ||
}, | ||
}, | ||
{ | ||
// JSON files | ||
files: ["*.json"], | ||
plugins: ["json"], | ||
extends: ["plugin:json/recommended", "prettier"], | ||
rules: { | ||
"json/*": [ | ||
"error", | ||
{ | ||
allowComments: true, | ||
}, | ||
], | ||
}, | ||
}, | ||
{ | ||
// CoffeeScript and CSON files | ||
files: ["**/*.coffee", "**/*.cson"], | ||
parser: "eslint-plugin-coffee", | ||
plugins: ["coffee", "node", "only-warn"], | ||
extends: ["plugin:coffee/eslint-recommended", "plugin:optimize-regex/all", "plugin:coffee/prettier"], | ||
rules: { | ||
...pluginNodeRules, | ||
...pluginImportExtraRules, | ||
}, | ||
}, | ||
{ | ||
// YAML files | ||
files: ["*.yaml", "*.yml"], | ||
plugins: ["yaml"], | ||
extends: ["plugin:yaml/recommended"], | ||
}, | ||
], | ||
settings: { | ||
"import/core-modules": ["atom", "electron"], | ||
// support TypeScript and Coffee importing | ||
"import/extensions": [".ts", ".tsx", ".d.ts", ".js", ".jsx", ".coffee"], | ||
"import/external-module-folders": ["node_modules", "node_modules/@types"], | ||
"import/parsers": { | ||
"@typescript-eslint/parser": [".ts", ".tsx", ".d.ts"], | ||
}, | ||
"import/resolver": { | ||
node: { | ||
extensions: [".ts", ".tsx", ".d.ts", ".js", ".jsx", ".coffee"], | ||
}, | ||
}, | ||
}, | ||
} | ||
module.exports = require("./src/index.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
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 |
---|---|---|
@@ -1,23 +1 @@ | ||
const base = require("./index.js") | ||
|
||
let overrides = base.overrides | ||
// TypeScript: | ||
overrides[0] = { | ||
...overrides[0], | ||
plugins: ["react", ...overrides[0].plugins], | ||
extends: ["plugin:react/recommended", ...overrides[0].extends], | ||
rules: overrides[0].rules, | ||
} | ||
|
||
module.exports = { | ||
...base, | ||
plugins: ["react", ...base.plugins], | ||
extends: ["plugin:react/recommended", ...base.extends], | ||
overrides: overrides, | ||
settings: { | ||
...(base.settings || {}), | ||
react: { | ||
version: "detect", | ||
}, | ||
}, | ||
} | ||
module.exports = require("./src/index-react.js") |
This file was deleted.
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 @@ | ||
const { pluginNodeRules } = require("./plugin-node-rules") | ||
const { pluginImportRulesExtra } = require("./plugin-import-rules") | ||
|
||
exports.coffeeConfig = { | ||
// CoffeeScript files | ||
files: ["**/*.coffee"], | ||
parser: "eslint-plugin-coffee", | ||
plugins: ["coffee", "node", "only-warn"], | ||
extends: ["plugin:coffee/eslint-recommended", "plugin:optimize-regex/all", "plugin:coffee/prettier"], | ||
rules: { | ||
...pluginNodeRules, | ||
...pluginImportRulesExtra, | ||
}, | ||
} |
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,6 @@ | ||
const { coffeeConfig } = require("./coffeescript") | ||
|
||
exports.csonConfig = { | ||
...coffeeConfig, | ||
files: ["**/*.cson"], | ||
} |
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,25 @@ | ||
const base = require("./index.js") | ||
const { tsConfig } = require("./typescript") | ||
|
||
module.exports = { | ||
...base, | ||
plugins: ["react", ...base.plugins], | ||
extends: ["plugin:react/recommended", ...base.extends], | ||
overrides: [ | ||
// TypeScript: | ||
{ | ||
...tsConfig, | ||
plugins: ["react", ...tsConfig.plugins], | ||
extends: ["plugin:react/recommended", ...tsConfig.extends], | ||
rules: tsConfig.rules, | ||
}, | ||
// The rest is the same | ||
...base.overrides.slice(1), | ||
], | ||
settings: { | ||
...(base.settings || {}), | ||
react: { | ||
version: "detect", | ||
}, | ||
}, | ||
} |
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,15 @@ | ||
const nonStrictConfig = require("./index-react") | ||
|
||
// remove only-warn from javascript | ||
if (nonStrictConfig.plugins[nonStrictConfig.plugins.length - 1] === "only-warn") { | ||
nonStrictConfig.plugins.pop() | ||
} | ||
|
||
// remove only-warn from overrides | ||
nonStrictConfig.overrides.forEach((overrides) => { | ||
if (overrides.plugins[overrides.plugins.length - 1] === "only-warn") { | ||
overrides.plugins.pop() | ||
} | ||
}) | ||
|
||
module.exports = nonStrictConfig |
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,15 @@ | ||
const nonStrictConfig = require("./index") | ||
|
||
// remove only-warn from javascript | ||
if (nonStrictConfig.plugins[nonStrictConfig.plugins.length - 1] === "only-warn") { | ||
nonStrictConfig.plugins.pop() | ||
} | ||
|
||
// remove only-warn from overrides | ||
nonStrictConfig.overrides.forEach((overrides) => { | ||
if (overrides.plugins[overrides.plugins.length - 1] === "only-warn") { | ||
overrides.plugins.pop() | ||
} | ||
}) | ||
|
||
module.exports = nonStrictConfig |
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,27 @@ | ||
const { jsConfig } = require("./javascript") | ||
const { tsConfig } = require("./typescript") | ||
const { coffeeConfig } = require("./coffeescript") | ||
const { jsonConfig } = require("./json") | ||
const { csonConfig } = require("./cson") | ||
const { yamlConfig } = require("./yaml") | ||
const { pluginImportSettings } = require("./plugin-import-rules") | ||
|
||
module.exports = { | ||
root: true, | ||
env: { | ||
atomtest: true, | ||
es6: true, | ||
node: true, | ||
browser: true, | ||
jasmine: true, | ||
}, | ||
globals: { | ||
atom: "readonly", | ||
measure: "readonly", | ||
}, | ||
...jsConfig, | ||
overrides: [tsConfig, coffeeConfig, jsonConfig, csonConfig, yamlConfig], | ||
settings: { | ||
...pluginImportSettings, | ||
}, | ||
} |
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 @@ | ||
const { pluginNodeRules } = require("./plugin-node-rules") | ||
const { pluginImportRulesExtra } = require("./plugin-import-rules") | ||
|
||
exports.jsConfig = { | ||
parser: "babel-eslint", | ||
parserOptions: { | ||
ecmaFeatures: { | ||
jsx: true, | ||
}, | ||
ecmaVersion: 2021, | ||
sourceType: "module", | ||
}, | ||
plugins: ["node", "import", "only-warn"], | ||
extends: ["eslint:recommended", "plugin:optimize-regex/all", "plugin:import/recommended", "prettier"], | ||
ignorePatterns: ["node_modules/"], | ||
rules: { | ||
...pluginNodeRules, | ||
...pluginImportRulesExtra, | ||
}, | ||
} |
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 @@ | ||
exports.jsonConfig = { | ||
// JSON files | ||
files: ["*.json"], | ||
plugins: ["json"], | ||
extends: ["plugin:json/recommended", "prettier"], | ||
rules: { | ||
"json/*": [ | ||
"error", | ||
{ | ||
allowComments: 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
exports.pluginImportRulesExtra = { | ||
"import/no-absolute-path": "error", | ||
"import/no-useless-path-segments": "error", | ||
"import/no-deprecated": "error", | ||
"import/no-extraneous-dependencies": "error", | ||
"import/no-unassigned-import": "warn", | ||
"import/no-mutable-exports": "warn", | ||
"import/no-anonymous-default-export": "error", | ||
"import/no-amd": "error", | ||
//// might be too restrictive: | ||
// "import/no-commonjs": "warn", | ||
// "import/no-dynamic-require": "warn", // prevent abusing dynamic require | ||
//// don't work properly: | ||
// "import/unambiguous": "error", | ||
// "import/no-unused-modules": ["warn", {"missingExports": true}], | ||
} | ||
|
||
exports.pluginImportTypeScriptRulesExtra = { | ||
// Buggy on TypeScript: | ||
"import/no-unresolved": "off", | ||
"import/named": "off", | ||
"import/namespace": "off", | ||
} | ||
|
||
exports.pluginImportSettings = { | ||
"import/core-modules": ["atom", "electron"], | ||
// support TypeScript and Coffee importing | ||
"import/extensions": [".ts", ".tsx", ".d.ts", ".js", ".jsx", ".coffee"], | ||
"import/external-module-folders": ["node_modules", "node_modules/@types"], | ||
"import/parsers": { | ||
"@typescript-eslint/parser": [".ts", ".tsx", ".d.ts"], | ||
}, | ||
"import/resolver": { | ||
node: { | ||
extensions: [".ts", ".tsx", ".d.ts", ".js", ".jsx", ".coffee"], | ||
}, | ||
}, | ||
} |
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,8 @@ | ||
exports.pluginNodeRules = { | ||
"node/no-exports-assign": "error", | ||
"node/process-exit-as-throw": "error", | ||
"node/shebang": "error", | ||
"node/no-deprecated-api": "error", | ||
"node/prefer-promises/dns": "error", | ||
"node/prefer-promises/fs": "error", | ||
} |
Oops, something went wrong.