Skip to content

Commit b5473ce

Browse files
committed
feat(config): export only the Prettier-compatible config
BREAKING CHANGE: now exports only the recommended config, Prettier-compatible. There is no reason to have separate config since it no longer mandates Prettier usage.
1 parent 4d3574d commit b5473ce

File tree

10 files changed

+8
-171
lines changed

10 files changed

+8
-171
lines changed

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,5 +88,4 @@ lib64
8888
# -------------------------------------------------
8989
# Your own project's ignores
9090
# -------------------------------------------------
91-
src/prettier.json
92-
src/recommended.json
91+
src/*.json

README.md

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,22 +27,13 @@ module.exports = {
2727

2828
### With Prettier
2929

30-
This ESLint plugin comes with a built-in Prettier-compatible config. First, install Prettier:
30+
This recommended config is Prettier-compatible. First, install Prettier:
3131

3232
```sh
3333
npm install --save-dev prettier
3434
```
3535

36-
Switch to the Prettier config:
37-
38-
```js
39-
module.exports = {
40-
// https://github.com/thibaudcolas/eslint-plugin-cookbook
41-
extends: "plugin:@thibaudcolas/cookbook/prettier",
42-
};
43-
```
44-
45-
Then, to configure Prettier itself, create a `prettier.config.js` file in the root of your project with:
36+
Then, to configure Prettier itself, create a `prettier.config.js` file in the root of your project. You can use the following to get started:
4637

4738
```js
4839
// https://github.com/thibaudcolas/eslint-plugin-cookbook

src/__snapshots__/base.test.js.snap

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ Object {
1111
},
1212
"extends": Array [
1313
"airbnb",
14+
"prettier",
15+
"prettier/flowtype",
16+
"prettier/react",
1417
],
1518
"rules": Object {
1619
"arrow-body-style": Array [

src/__snapshots__/semver.test.js.snap

Lines changed: 0 additions & 130 deletions
Original file line numberDiff line numberDiff line change
@@ -1,135 +1,5 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

3-
exports[`semver - should those tests break, consider releasing a new major version of the package custom config 1`] = `
4-
Object {
5-
"env": Object {
6-
"browser": true,
7-
"commonjs": true,
8-
"es6": true,
9-
"jest": true,
10-
"node": true,
11-
},
12-
"extends": Array [
13-
"airbnb",
14-
],
15-
"rules": Object {
16-
"arrow-body-style": Array [
17-
0,
18-
],
19-
"eol-last": Array [
20-
1,
21-
],
22-
"id-length": Array [
23-
0,
24-
],
25-
"import/no-extraneous-dependencies": Array [
26-
2,
27-
Object {
28-
"devDependencies": true,
29-
"optionalDependencies": false,
30-
"peerDependencies": false,
31-
},
32-
],
33-
"import/prefer-default-export": Array [
34-
0,
35-
],
36-
"indent": Array [
37-
2,
38-
4,
39-
],
40-
"jsx-a11y/label-has-for": Array [
41-
0,
42-
],
43-
"jsx-quotes": Array [
44-
1,
45-
"prefer-double",
46-
],
47-
"max-len": Array [
48-
1,
49-
120,
50-
4,
51-
Object {
52-
"ignoreUrls": true,
53-
},
54-
],
55-
"no-console": Array [
56-
1,
57-
Object {
58-
"allow": Array [
59-
"warn",
60-
"error",
61-
"time",
62-
"timeEnd",
63-
],
64-
},
65-
],
66-
"no-multi-spaces": Array [
67-
0,
68-
],
69-
"no-new": Array [
70-
1,
71-
],
72-
"no-param-reassign": Array [
73-
2,
74-
Object {
75-
"props": false,
76-
},
77-
],
78-
"no-plusplus": Array [
79-
0,
80-
],
81-
"no-warning-comments": Array [
82-
1,
83-
Object {
84-
"location": "start",
85-
"terms": Array [
86-
"todo",
87-
"fixme",
88-
"xxx",
89-
],
90-
},
91-
],
92-
"object-shorthand": Array [
93-
2,
94-
"methods",
95-
],
96-
"react/forbid-prop-types": Array [
97-
2,
98-
Object {
99-
"forbid": Array [
100-
"any",
101-
],
102-
},
103-
],
104-
"react/jsx-boolean-value": Array [
105-
0,
106-
],
107-
"react/jsx-filename-extension": Array [
108-
2,
109-
Object {
110-
"extensions": Array [
111-
".js",
112-
],
113-
},
114-
],
115-
"react/jsx-indent": Array [
116-
2,
117-
4,
118-
],
119-
"react/jsx-indent-props": Array [
120-
2,
121-
4,
122-
],
123-
"react/jsx-no-bind": Array [
124-
0,
125-
],
126-
"react/sort-comp": Array [
127-
0,
128-
],
129-
},
130-
}
131-
`;
132-
1333
exports[`semver - should those tests break, consider releasing a new major version of the package dependencies 1`] = `
1344
Object {
1355
"eslint-plugin-import": "^2.14.0",

src/base.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module.exports = {
2-
extends: ["airbnb"],
2+
extends: ["airbnb", "prettier", "prettier/flowtype", "prettier/react"],
33

44
rules: {
55
indent: [2, 4],

src/base.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ describe("config", () => {
1111
});
1212

1313
expect(cli.executeOnText("var foo\n")).toMatchObject({
14-
errorCount: 3,
14+
errorCount: 2,
1515
warningCount: 0,
1616
});
1717
});

src/buildConfigs.js

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,6 @@ const base = require("./base");
1313

1414
const configs = {
1515
recommended: base,
16-
prettier: {
17-
extends: base.extends.concat([
18-
"prettier",
19-
"prettier/flowtype",
20-
"prettier/react",
21-
]),
22-
},
2316
};
2417

2518
Object.keys(configs).forEach((name) => {

src/buildConfigs.test.js

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,4 @@ describe("buildConfigs", () => {
2929
errorCount: 4,
3030
});
3131
});
32-
33-
it("prettier is valid", () => {
34-
const cli = new CLIEngine({
35-
baseConfig: convertRefs(require("./prettier.json")),
36-
});
37-
38-
expect(
39-
cli.executeOnText("import test from 'potato'; var foo;", "foo.js"),
40-
).toMatchObject({
41-
errorCount: 4,
42-
});
43-
});
4432
});

src/index.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
const { getPrefixedPluginRules } = require("./plugins");
22
const recommended = require("./recommended.json");
3-
const prettier = require("./prettier.json");
43

54
module.exports = {
65
configs: {
76
recommended: recommended,
8-
prettier: prettier,
97
},
108
rules: getPrefixedPluginRules(),
119
};

src/semver.test.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
const pkg = require("../package.json");
2-
const config = require("./base");
32

43
describe("semver - should those tests break, consider releasing a new major version of the package", () => {
54
it("dependencies", () => {
@@ -19,8 +18,4 @@ describe("semver - should those tests break, consider releasing a new major vers
1918
}, {});
2019
expect(devDependencies).toMatchSnapshot();
2120
});
22-
23-
it("custom config", () => {
24-
expect(config).toMatchSnapshot();
25-
});
2621
});

0 commit comments

Comments
 (0)