Skip to content

Commit

Permalink
feat: Add polyglot-specific config, e.g., to prevent Node modules or …
Browse files Browse the repository at this point in the history
…browser APIs
  • Loading branch information
brettz9 committed Jul 16, 2024
1 parent 8d4247c commit 7cf9e04
Show file tree
Hide file tree
Showing 79 changed files with 587 additions and 386 deletions.
File renamed without changes.
13 changes: 13 additions & 0 deletions bare.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/* eslint-disable jsdoc/imports-as-dependencies -- Bug */
import {builtinModules} from 'node:module';

/** @type {import('eslint').Linter.FlatConfig[]} */
export default [
{
rules: {
'no-restricted-imports': ['error', {
paths: builtinModules
}]
}
}
];
1 change: 1 addition & 0 deletions cypress.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export default [
},
...mochaPlus,
{
files: ['cypress/e2e/**'],
rules: {
// Conflicts with Cypress `should`
'mocha-cleanup/invalid-assertions': 0
Expand Down
7 changes: 7 additions & 0 deletions dist/babel.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/**
* Allows passing in a whole config to wrap.
* @param {import('eslint').Linter.FlatConfig} config
* @returns {import('eslint').Linter.FlatConfig}
*/
export default function babelConfig(config: import("eslint").Linter.FlatConfig): import("eslint").Linter.FlatConfig;
//# sourceMappingURL=babel.d.ts.map
1 change: 1 addition & 0 deletions dist/babel.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions dist/bare.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
declare const _default: import("eslint").Linter.FlatConfig[];
export default _default;
//# sourceMappingURL=bare.d.ts.map
1 change: 1 addition & 0 deletions dist/bare.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions dist/browser.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
declare const _default: import("eslint").Linter.FlatConfig[];
export default _default;
//# sourceMappingURL=browser.d.ts.map
1 change: 1 addition & 0 deletions dist/browser.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/cypress.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 7 additions & 5 deletions dist/detectEnv.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,25 @@ export namespace languageOptions {
export { globals };
export { ecmaVersion };
}
export type EcmaVersion = 2024 | 2023 | 2022 | 2021 | 2020 | 2019 | 2018 | 2017 | 2016 | 2015 | 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15;
/**
* @param {string} packagePath
*/
export function detectNodeVersion(packagePath: string): string | semver.SemVer;
/**
* @param {string|import('semver').SemVer} nodeVersion
* @returns {EcmaVersion}
*/
export function getEcmaVersionForNodeVersion(nodeVersion: string | import("semver").SemVer): 5 | 2015 | 2016 | 2017 | 2018 | 2019 | 2020 | 2021;
export function getEcmaVersionForNodeVersion(nodeVersion: string | import("semver").SemVer): EcmaVersion;
/**
* @param {{
* ecmaVersion: number,
* ecmaVersion: EcmaVersion,
* nodeVersion: string|import('semver').SemVer,
* node?: boolean
* }} cfg
*/
export function getGlobalsForEcmaVersion({ ecmaVersion, nodeVersion, node }: {
ecmaVersion: number;
ecmaVersion: EcmaVersion;
nodeVersion: string | import("semver").SemVer;
node?: boolean;
}): {};
Expand All @@ -27,10 +29,10 @@ export function getGlobalsForEcmaVersion({ ecmaVersion, nodeVersion, node }: {
*/
export function getGlobalsAndEcmaVersionForCwd(cwd: string): {
globals: {};
ecmaVersion: number;
ecmaVersion: EcmaVersion;
};
declare const globals: {};
declare const ecmaVersion: 5 | 2015 | 2016 | 2017 | 2018 | 2019 | 2020 | 2021;
declare const ecmaVersion: EcmaVersion;
import semver from 'semver';
export {};
//# sourceMappingURL=detectEnv.d.ts.map
2 changes: 1 addition & 1 deletion dist/detectEnv.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/eslint.config.3rdparty.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/eslint.config.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions dist/great-eye-node.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
declare const _default: import("eslint").Linter.FlatConfig[];
export default _default;
export default function greatEyeNode(pkg: {
type?: "module" | "commonjs";
}): import("eslint").Linter.FlatConfig[];
//# sourceMappingURL=great-eye-node.d.ts.map
2 changes: 1 addition & 1 deletion dist/great-eye-node.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions dist/great-eye.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
declare const _default: import("eslint").Linter.FlatConfig[];
export default _default;
export default function greatEye(pkg: {
type?: "module" | "commonjs";
}): import("eslint").Linter.FlatConfig[];
//# sourceMappingURL=great-eye.d.ts.map
2 changes: 1 addition & 1 deletion dist/great-eye.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 14 additions & 2 deletions dist/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
declare const _default: import("eslint").Linter.FlatConfig[];
export default _default;
/**
* @typedef {("great-eye"|"sauron"|"saruman"|
* "polyglot"|"bare"|"node"|"browser"|
* "no-overrides"|
* "script"|"module"|
* "cypress"|"mocha"|
* "babel"|"third-party")[]} Types
*/
/**
* @param {Types} types
* @param {import('eslint').Linter.FlatConfig} [config]
*/
export default function index(types: Types, config?: import("eslint").Linter.FlatConfig<import("eslint").Linter.RulesRecord> | undefined): import("eslint").Linter.FlatConfig<import("eslint").Linter.RulesRecord>[];
export type Types = ("great-eye" | "sauron" | "saruman" | "polyglot" | "bare" | "node" | "browser" | "no-overrides" | "script" | "module" | "cypress" | "mocha" | "babel" | "third-party")[];
//# sourceMappingURL=index.d.ts.map
2 changes: 1 addition & 1 deletion dist/index.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions dist/main.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export default function main(cfg: {
type?: "module" | "commonjs";
}): import("eslint").Linter.FlatConfig[];
//# sourceMappingURL=main.d.ts.map
1 change: 1 addition & 0 deletions dist/main.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/mocha-plus.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions dist/modules.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
declare const _default: import("eslint").Linter.FlatConfig[];
export default _default;
//# sourceMappingURL=modules.d.ts.map
1 change: 1 addition & 0 deletions dist/modules.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions dist/node.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
declare const _default: import("eslint").Linter.FlatConfig[];
export default _default;
export default function node(pkg: {
type?: "module" | "commonjs";
}): import("eslint").Linter.FlatConfig[];
//# sourceMappingURL=node.d.ts.map
2 changes: 1 addition & 1 deletion dist/node.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions dist/overrides-module.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
declare const _default: import("eslint").Linter.FlatConfig[];
export default _default;
//# sourceMappingURL=overrides-module.d.ts.map
1 change: 1 addition & 0 deletions dist/overrides-module.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions dist/overrides-script.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
declare const _default: import("eslint").Linter.FlatConfig[];
export default _default;
//# sourceMappingURL=overrides-script.d.ts.map
1 change: 1 addition & 0 deletions dist/overrides-script.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions dist/overrides.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export default function overrides(types: import("./index.js").Types, pkg: {
type?: "module" | "commonjs";
}): import("eslint").Linter.FlatConfig[];
//# sourceMappingURL=overrides.d.ts.map
1 change: 1 addition & 0 deletions dist/overrides.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions dist/polyglot.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
declare const _default: import("eslint").Linter.FlatConfig[];
export default _default;
//# sourceMappingURL=polyglot.d.ts.map
1 change: 1 addition & 0 deletions dist/polyglot.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 9 additions & 2 deletions dist/sauron-node-overrides.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
declare const _default: import("eslint").Linter.FlatConfig[];
export default _default;
/**
* @param {import('./index.js').Types} types
* @param {{
* type?: "module"|"commonjs"
* }} pkg
*/
export default function sauronNodeOverrides(types: import("./index.js").Types, pkg: {
type?: "module" | "commonjs";
}): import("eslint").Linter.FlatConfig<import("eslint").Linter.RulesRecord>[];
//# sourceMappingURL=sauron-node-overrides.d.ts.map
2 changes: 1 addition & 1 deletion dist/sauron-node-overrides.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions dist/sauron-node-script-overrides.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
declare const _default: import("eslint").Linter.FlatConfig[];
export default _default;
export default function sauronNodeScriptOverrides(types: import("./index.js").Types, pkg: {
type?: "module" | "commonjs";
}): import("eslint").Linter.FlatConfig[];
//# sourceMappingURL=sauron-node-script-overrides.d.ts.map
2 changes: 1 addition & 1 deletion dist/sauron-node-script-overrides.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions dist/sauron-node-script.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
declare const _default: import("eslint").Linter.FlatConfig[];
export default _default;
export default function sauronNodeScript(pkg: {
type?: "module" | "commonjs";
}): import("eslint").Linter.FlatConfig[];
//# sourceMappingURL=sauron-node-script.d.ts.map
2 changes: 1 addition & 1 deletion dist/sauron-node-script.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions dist/sauron-node.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
declare const _default: import("eslint").Linter.FlatConfig[];
export default _default;
export default function sauronNode(pkg: {
type?: "module" | "commonjs";
}): import("eslint").Linter.FlatConfig[];
//# sourceMappingURL=sauron-node.d.ts.map
2 changes: 1 addition & 1 deletion dist/sauron-node.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions dist/sauron-overrides.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
declare const _default: import("eslint").Linter.FlatConfig[];
export default _default;
export default function sauronOverrides(types: import("./index.js").Types, pkg: {
type?: "module" | "commonjs";
}): import("eslint").Linter.FlatConfig[];
//# sourceMappingURL=sauron-overrides.d.ts.map
2 changes: 1 addition & 1 deletion dist/sauron-overrides.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions dist/sauron-script-overrides.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
declare const _default: import("eslint").Linter.FlatConfig[];
export default _default;
export default function sauronScriptOverrides(types: import("./index.js").Types, pkg: {
type?: "module" | "commonjs";
}): import("eslint").Linter.FlatConfig[];
//# sourceMappingURL=sauron-script-overrides.d.ts.map
2 changes: 1 addition & 1 deletion dist/sauron-script-overrides.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions dist/sauron-script.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
declare const _default: import("eslint").Linter.FlatConfig[];
export default _default;
export default function sauronScript(pkg: {
type?: "module" | "commonjs";
}): import("eslint").Linter.FlatConfig[];
//# sourceMappingURL=sauron-script.d.ts.map
2 changes: 1 addition & 1 deletion dist/sauron-script.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions dist/sauron.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
declare const _default: import("eslint").Linter.FlatConfig[];
export default _default;
export default function sauron(pkg: {
type?: "module" | "commonjs";
}): import("eslint").Linter.FlatConfig[];
//# sourceMappingURL=sauron.d.ts.map
2 changes: 1 addition & 1 deletion dist/sauron.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions dist/script-node.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
declare const _default: import("eslint").Linter.FlatConfig[];
export default _default;
//# sourceMappingURL=script-node.d.ts.map
1 change: 1 addition & 0 deletions dist/script-node.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions dist/script.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
declare const _default: import("eslint").Linter.FlatConfig[];
export default _default;
//# sourceMappingURL=script.d.ts.map
1 change: 1 addition & 0 deletions dist/script.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions dist/third-party.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
declare const _default: import("eslint").Linter.FlatConfig[];
export default _default;
//# sourceMappingURL=third-party.d.ts.map
1 change: 1 addition & 0 deletions dist/third-party.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import index from './index.js';
/** @type {import('eslint').Linter.FlatConfig[]} */
const config = [
...index([
'sauron', 'node', 'overrides'
'sauron', 'node'
]),
{
files: ['inherited-rules/**'],
Expand Down
Loading

0 comments on commit 7cf9e04

Please sign in to comment.