Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Un-break configs. #36

Merged
merged 4 commits into from
Mar 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 20 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ Install with:
npm install --save-dev @peggyjs/eslint-plugin @peggyjs/eslint-parser eslint
```

(update this when we publish!)

Add to your `.eslintrc.js` file:

```js
Expand All @@ -21,26 +19,6 @@ module.exports = {
};
```

Or, if you are using ESLint Flat configs, add this to your `eslint.config.js`
file:

```js
// ESM
import peggylint from "@peggyjs/eslint-plugin/lib/flat/recommended.js"
export default [
peggyLint,
];
```

Or:

```js
// CommonJS
module.exports = [
...require("@peggyjs/eslint-plugin/lib/flat/recommended.js"),
];
```

You can also use "plugin:@peggyjs/all" or to get ALL of the rules.
If you'd like more control:

Expand Down Expand Up @@ -72,6 +50,26 @@ module.exports = {
};
```

Or, if you are using ESLint Flat configs, add this to your `eslint.config.js`
file:

```js
// ESM
import peggylint from "@peggyjs/eslint-plugin/lib/flat/recommended.js"
export default [
peggyLint,
];
```

Or:

```js
// CommonJS
module.exports = [
...require("@peggyjs/eslint-plugin/lib/flat/recommended.js"),
];
```

## VSCode

If you are using VSCode, you might be interested in these for your `.vscode/settings.json` file:
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"@types/debug": "4.1.12",
"@types/eslint": "8.56.5",
"@types/estree": "1.0.5",
"@types/node": "20.11.22",
"@types/node": "20.11.24",
"@types/requireindex": "1.2.4",
"@typescript-eslint/eslint-plugin": "7.1.0",
"@typescript-eslint/parser": "7.1.0",
Expand Down
8 changes: 4 additions & 4 deletions pnpm-lock.yaml

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

2 changes: 1 addition & 1 deletion src/rules/camelCase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,4 +119,4 @@ const rule: Rule.RuleModule = {
},
};

export default rule;
export = rule;
2 changes: 1 addition & 1 deletion src/rules/equal-next-line.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,4 +148,4 @@ const rule: Rule.RuleModule = {
},
};

export default rule;
export = rule;
2 changes: 1 addition & 1 deletion src/rules/no-empty-code-blocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,4 @@ const rule: Rule.RuleModule = {
},
};

export default rule;
export = rule;
2 changes: 1 addition & 1 deletion src/rules/no-empty-initializers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,4 @@ const rule: Rule.RuleModule = {
},
};

export default rule;
export = rule;
2 changes: 1 addition & 1 deletion src/rules/no-unused-labels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,4 @@ const rule: Rule.RuleModule = {
},
};

export default rule;
export = rule;
2 changes: 1 addition & 1 deletion src/rules/no-unused-rules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,4 @@ const rule: Rule.RuleModule = {
},
};

export default rule;
export = rule;
2 changes: 1 addition & 1 deletion src/rules/quotes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,4 +118,4 @@ const rule: Rule.RuleModule = {
},
};

export default rule;
export = rule;
2 changes: 1 addition & 1 deletion src/rules/rule-order.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,4 @@ const rule: Rule.RuleModule = {
},
};

export default rule;
export = rule;
2 changes: 1 addition & 1 deletion src/rules/semantic-predicate-must-return.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ const rule: Rule.RuleModule = {
},
};

export default rule;
export = rule;
2 changes: 1 addition & 1 deletion src/rules/semi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,4 @@ const rule: Rule.RuleModule = {
},
};

export default rule;
export = rule;
2 changes: 1 addition & 1 deletion src/rules/separate-choices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,4 @@ const rule: Rule.RuleModule = {
},
};

export default rule;
export = rule;
2 changes: 1 addition & 1 deletion src/rules/space-ops.ts
Original file line number Diff line number Diff line change
Expand Up @@ -239,4 +239,4 @@ const rule: Rule.RuleModule = {
},
};

export default rule;
export = rule;
2 changes: 1 addition & 1 deletion src/rules/valid-imports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,4 +199,4 @@ const rule: Rule.RuleModule = {
},
};

export default rule;
export = rule;
4 changes: 2 additions & 2 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ export function dirMap(...dirs: string[]): { [id: string]: object } {
.map(fileName => fileName.replace(/\.js$/, ""))
.map(entryName => [
entryName,
// eslint-disable-next-line @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires
require(path.join(dirName, entryName)).default,
// eslint-disable-next-line @typescript-eslint/no-require-imports
require(path.join(dirName, entryName)),
])
);
}
5 changes: 5 additions & 0 deletions test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,10 @@ describe("plugin", () => {
it("loads", () => {
assert(index);
assert.equal(typeof index, "object");
assert(index.configs);
assert(index.configs.all);
assert(index.configs.recommended);
assert(index.rules);
assert(index.processors);
});
});
2 changes: 1 addition & 1 deletion test/rules/camelCase.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use strict";

const rule = require("../../lib/rules/camelCase").default;
const rule = require("../../lib/rules/camelCase");
const RuleTester = require("eslint").RuleTester;

const ruleTester = new RuleTester({
Expand Down
2 changes: 1 addition & 1 deletion test/rules/equal-next-line.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use strict";

const rule = require("../../lib/rules/equal-next-line").default;
const rule = require("../../lib/rules/equal-next-line");
const RuleTester = require("eslint").RuleTester;

const ruleTester = new RuleTester({
Expand Down
2 changes: 1 addition & 1 deletion test/rules/no-empty-code-blocks.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use strict";

const rule = require("../../lib/rules/no-empty-code-blocks").default;
const rule = require("../../lib/rules/no-empty-code-blocks");
const RuleTester = require("eslint").RuleTester;

const ruleTester = new RuleTester({
Expand Down
2 changes: 1 addition & 1 deletion test/rules/no-empty-initializers.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use strict";

const rule = require("../../lib/rules/no-empty-initializers").default;
const rule = require("../../lib/rules/no-empty-initializers");
const RuleTester = require("eslint").RuleTester;

const ruleTester = new RuleTester({
Expand Down
2 changes: 1 addition & 1 deletion test/rules/no-unused-labels.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use strict";

const rule = require("../../lib/rules/no-unused-labels").default;
const rule = require("../../lib/rules/no-unused-labels");
const RuleTester = require("eslint").RuleTester;

const ruleTester = new RuleTester({
Expand Down
2 changes: 1 addition & 1 deletion test/rules/no-unused-rules.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use strict";

const rule = require("../../lib/rules/no-unused-rules").default;
const rule = require("../../lib/rules/no-unused-rules");
const RuleTester = require("eslint").RuleTester;

const ruleTester = new RuleTester({
Expand Down
2 changes: 1 addition & 1 deletion test/rules/quotes.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use strict";

const rule = require("../../lib/rules/quotes").default;
const rule = require("../../lib/rules/quotes");
const RuleTester = require("eslint").RuleTester;

const ruleTester = new RuleTester({
Expand Down
2 changes: 1 addition & 1 deletion test/rules/rule-order.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use strict";

const rule = require("../../lib/rules/rule-order").default;
const rule = require("../../lib/rules/rule-order");
const RuleTester = require("eslint").RuleTester;

const ruleTester = new RuleTester({
Expand Down
2 changes: 1 addition & 1 deletion test/rules/semantic-predicate-must-return.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use strict";

const rule = require("../../lib/rules/semantic-predicate-must-return").default;
const rule = require("../../lib/rules/semantic-predicate-must-return");
const RuleTester = require("eslint").RuleTester;

const ruleTester = new RuleTester({
Expand Down
2 changes: 1 addition & 1 deletion test/rules/semi.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use strict";

const rule = require("../../lib/rules/semi").default;
const rule = require("../../lib/rules/semi");
const RuleTester = require("eslint").RuleTester;

const ruleTester = new RuleTester({
Expand Down
2 changes: 1 addition & 1 deletion test/rules/separate-choices.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use strict";

const rule = require("../../lib/rules/separate-choices").default;
const rule = require("../../lib/rules/separate-choices");
const RuleTester = require("eslint").RuleTester;

const ruleTester = new RuleTester({
Expand Down
2 changes: 1 addition & 1 deletion test/rules/space-ops.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use strict";

const rule = require("../../lib/rules/space-ops").default;
const rule = require("../../lib/rules/space-ops");
const RuleTester = require("eslint").RuleTester;

const ruleTester = new RuleTester({
Expand Down
2 changes: 1 addition & 1 deletion test/rules/valid-imports.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use strict";

const rule = require("../../lib/rules/valid-imports").default;
const rule = require("../../lib/rules/valid-imports");
const RuleTester = require("eslint").RuleTester;

const filename = __filename;
Expand Down
Loading