Skip to content

Commit e32a9e9

Browse files
committed
chore(repo): update linting, prettier configuration
1 parent 9e31d93 commit e32a9e9

File tree

20 files changed

+721
-257
lines changed

20 files changed

+721
-257
lines changed

.eslintrc.js

+10-60
Original file line numberDiff line numberDiff line change
@@ -1,78 +1,28 @@
11
module.exports = {
22
extends: ['rollup', 'plugin:import/typescript'],
3-
parser: '@typescript-eslint/parser',
43
parserOptions: {
54
project: ['./tsconfig.eslint.json', './packages/*/tsconfig.json'],
65
tsconfigRootDir: __dirname
76
},
8-
plugins: ['@typescript-eslint'],
97
rules: {
10-
'@typescript-eslint/consistent-type-assertions': 'error',
11-
'@typescript-eslint/consistent-type-definitions': 'error',
12-
'@typescript-eslint/member-ordering': 'error',
13-
'@typescript-eslint/no-inferrable-types': 'error',
14-
'@typescript-eslint/no-redeclare': 'error',
15-
'@typescript-eslint/no-unnecessary-type-assertion': 'error',
16-
'@typescript-eslint/no-unused-vars': [
17-
'error',
18-
{
19-
vars: 'local',
20-
args: 'after-used',
21-
ignoreRestSiblings: true
22-
}
23-
],
24-
'import/extensions': [
25-
'error',
26-
'always',
27-
{
28-
js: 'never',
29-
jsx: 'never',
30-
ts: 'never',
31-
tsx: 'never'
32-
}
33-
],
34-
'import/no-extraneous-dependencies': [
35-
'error',
36-
{
37-
devDependencies: [
38-
'**/scripts/**/*.ts',
39-
'**/*.test.*',
40-
'**/test/**/*.js',
41-
'**/test/**/*.ts'
42-
],
43-
optionalDependencies: false
44-
}
45-
],
46-
'import/prefer-default-export': 'off',
47-
'import/no-namespace': 'off',
48-
'import/no-named-export': 'off',
49-
'no-redeclare': 'off',
50-
'no-unused-vars': 'off',
51-
'prefer-object-spread': 'off',
52-
'spaced-comment': 'off',
53-
'prettier/prettier': [
54-
'error',
55-
{
56-
arrowParens: 'always',
57-
printWidth: 100,
58-
singleQuote: true,
59-
trailingComma: 'none',
60-
plugins: ['prettier-plugin-package']
61-
}
62-
]
8+
// disabling sort keys for now so we can get the rest of the linting shored up
9+
'sort-keys': 'off',
10+
'typescript-sort-keys/interface': 'off'
6311
},
6412
overrides: [
6513
{
66-
'files': ['**/test/**/*.{js,ts}'],
14+
'files': ['**/fixtures/**'],
6715
'rules': {
68-
'no-console': 'off'
16+
'no-console': 'off',
17+
'import/extensions': 'off',
18+
'import/no-unresolved': 'off'
6919
}
7020
},
7121
{
72-
'files': ['**/*.ts'],
22+
'files': ['**/test/**'],
7323
'rules': {
74-
'no-undef': 'off'
24+
'import/extensions': 'off'
7525
}
7626
}
77-
]
27+
],
7828
};

.github/workflows/node-windows.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ on:
88
- synchronize
99
push:
1010
branches:
11-
- "*"
11+
- '*'
1212

1313
jobs:
1414
build:
1515
runs-on: windows-2019
1616

1717
strategy:
1818
matrix:
19-
node: ["16", "14", "12"]
19+
node: ['16', '14', '12']
2020

2121
name: Node v${{ matrix.node }}
2222
steps:

.github/workflows/validate.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ on:
88
- synchronize
99
push:
1010
branches:
11-
- "*"
11+
- '*'
1212

1313
jobs:
1414
build:
1515
runs-on: ubuntu-latest
1616

1717
strategy:
1818
matrix:
19-
node: ["16", "14", "12"]
19+
node: ['16', '14', '12']
2020

2121
name: Node v${{ matrix.node }}
2222

.prettierrc.js

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// Note: This file is necessary so that prettier writes which happen in hooks and scripts match the
2+
// same config that we're using from the eslint-config package.
3+
module.exports = require('eslint-config-rollup/prettier');

package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
"scripts": {
55
"ci:coverage:submit": "node scripts/codecov",
66
"lint": "pnpm lint:docs && pnpm --no-bail lint:json && pnpm lint:package && pnpm lint:js",
7-
"lint:docs": "prettier --single-quote --arrow-parens avoid --trailing-comma none --write **/README.md",
7+
"lint:docs": "prettier --write .github/**/*.md **/README.md",
88
"lint:js": "eslint --cache packages scripts shared util --ext .js,.ts",
9-
"lint:json": "prettier --write **/tsconfig*.json **/*.{yml,yaml}",
9+
"lint:json": "prettier --write .github/**/*.yml **/tsconfig.json tsconfig.*.json pnpm-workspace.yaml",
1010
"lint:package": "prettier --write **/package.json --plugin=prettier-plugin-package",
1111
"plugin:release": "ts-node ./scripts/release.ts",
1212
"preinstall": "node scripts/disallow-npm.js",
@@ -25,7 +25,7 @@
2525
"codecov-lite": "2.0.0",
2626
"conventional-commits-parser": "^3.2.1",
2727
"del-cli": "4.0.0",
28-
"eslint-config-rollup": "^1.0.0",
28+
"eslint-config-rollup": "^2.0.4",
2929
"esm": "^3.2.25",
3030
"execa": "^5.1.1",
3131
"globby": "^11.0.1",

packages/babel/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ It's main purpose is to allow other tools for configuration of transpilation wit
327327
```js
328328
import { createBabelInputPluginFactory } from '@rollup/plugin-babel';
329329

330-
export default createBabelInputPluginFactory(babelCore => {
330+
export default createBabelInputPluginFactory((babelCore) => {
331331
function myPlugin() {
332332
return {
333333
visitor: {}

packages/commonjs/README.md

+15-13
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ export default {
3434
input: 'src/index.js',
3535
output: {
3636
dir: 'output',
37-
format: 'cjs',
37+
format: 'cjs'
3838
},
39-
plugins: [commonjs()],
39+
plugins: [commonjs()]
4040
};
4141
```
4242

@@ -66,8 +66,8 @@ commonjs({
6666
'!node_modules/logform/index.js',
6767
'!node_modules/logform/format.js',
6868
'!node_modules/logform/levels.js',
69-
'!node_modules/logform/browser.js',
70-
],
69+
'!node_modules/logform/browser.js'
70+
]
7171
});
7272
```
7373

@@ -250,7 +250,7 @@ This is in line with how other bundlers handle this situation and is also the mo
250250

251251
var dep$1 = /*#__PURE__*/ Object.freeze({
252252
__proto__: null,
253-
default: dep,
253+
default: dep
254254
});
255255

256256
console.log(dep$1.default);
@@ -281,7 +281,7 @@ For these situations, you can change Rollup's behaviour either globally or per m
281281
enumerable: true,
282282
get: function () {
283283
return n[k];
284-
},
284+
}
285285
}
286286
);
287287
});
@@ -309,7 +309,9 @@ For these situations, you can change Rollup's behaviour either globally or per m
309309
import * as dep$1 from 'dep';
310310

311311
function getDefaultExportFromNamespaceIfNotNamed(n) {
312-
return n && Object.prototype.hasOwnProperty.call(n, 'default') && Object.keys(n).length === 1 ? n['default'] : n;
312+
return n && Object.prototype.hasOwnProperty.call(n, 'default') && Object.keys(n).length === 1
313+
? n['default']
314+
: n;
313315
}
314316

315317
var dep = getDefaultExportFromNamespaceIfNotNamed(dep$1);
@@ -357,9 +359,9 @@ export default {
357359
output: {
358360
file: 'bundle.js',
359361
format: 'iife',
360-
name: 'MyModule',
362+
name: 'MyModule'
361363
},
362-
plugins: [resolve(), commonjs()],
364+
plugins: [resolve(), commonjs()]
363365
};
364366
```
365367

@@ -369,7 +371,7 @@ Symlinks are common in monorepos and are also created by the `npm link` command.
369371

370372
```js
371373
commonjs({
372-
include: /node_modules/,
374+
include: /node_modules/
373375
});
374376
```
375377

@@ -392,11 +394,11 @@ function cjsDetectionPlugin() {
392394
moduleParsed({
393395
id,
394396
meta: {
395-
commonjs: { isCommonJS },
396-
},
397+
commonjs: { isCommonJS }
398+
}
397399
}) {
398400
console.log(`File ${id} is CommonJS: ${isCommonJS}`);
399-
},
401+
}
400402
};
401403
}
402404
```

packages/dsv/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ This option could be used for converting numeric `string` values into `Number` v
8282
```js
8383
dsv({
8484
processRow: (row, id) => {
85-
Object.keys(row).forEach(key => {
85+
Object.keys(row).forEach((key) => {
8686
var value = row[key];
8787
row[key] = isNaN(+value) ? value : +value;
8888
});

packages/dynamic-import-vars/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ export default {
4040
plugins: [
4141
dynamicImportVars({
4242
// options
43-
}),
44-
],
43+
})
44+
]
4545
};
4646
```
4747

packages/node-resolve/README.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ export default {
3434
input: 'src/index.js',
3535
output: {
3636
dir: 'output',
37-
format: 'cjs',
37+
format: 'cjs'
3838
},
39-
plugins: [nodeResolve()],
39+
plugins: [nodeResolve()]
4040
};
4141
```
4242

@@ -181,9 +181,9 @@ export default {
181181
output: {
182182
file: 'bundle.js',
183183
format: 'iife',
184-
name: 'MyModule',
184+
name: 'MyModule'
185185
},
186-
plugins: [nodeResolve(), commonjs()],
186+
plugins: [nodeResolve(), commonjs()]
187187
};
188188
```
189189

@@ -218,7 +218,7 @@ The node resolve plugin uses `import` by default, you can opt into using the `re
218218
```js
219219
this.resolve(importee, importer, {
220220
skipSelf: true,
221-
custom: { 'node-resolve': { isRequire: true } },
221+
custom: { 'node-resolve': { isRequire: true } }
222222
});
223223
```
224224

packages/pluginutils/README.md

+9-9
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export default function myPlugin(options = {}) {
5252
// only adds an extension if there isn't one already
5353
id = addExtension(id); // `foo` -> `foo.js`, `foo.js` -> `foo.js`
5454
id = addExtension(id, '.myext'); // `foo` -> `foo.myext`, `foo.js` -> `foo.js`
55-
},
55+
}
5656
};
5757
}
5858
```
@@ -88,9 +88,9 @@ export default function myPlugin(options = {}) {
8888
},
8989
leave(node) {
9090
if (node.scope) scope = scope.parent;
91-
},
91+
}
9292
});
93-
},
93+
}
9494
};
9595
}
9696
```
@@ -126,15 +126,15 @@ import { createFilter } from '@rollup/pluginutils';
126126
export default function myPlugin(options = {}) {
127127
// assume that the myPlugin accepts options of `options.include` and `options.exclude`
128128
var filter = createFilter(options.include, options.exclude, {
129-
resolve: '/my/base/dir',
129+
resolve: '/my/base/dir'
130130
});
131131

132132
return {
133133
transform(code, id) {
134134
if (!filter(id)) return;
135135

136136
// proceed with the transformation...
137-
},
137+
}
138138
};
139139
}
140140
```
@@ -160,14 +160,14 @@ import { dataToEsm } from '@rollup/pluginutils';
160160
const esModuleSource = dataToEsm(
161161
{
162162
custom: 'data',
163-
to: ['treeshake'],
163+
to: ['treeshake']
164164
},
165165
{
166166
compact: false,
167167
indent: '\t',
168168
preferConst: false,
169169
objectShorthand: false,
170-
namedExports: true,
170+
namedExports: true
171171
}
172172
);
173173
/*
@@ -209,9 +209,9 @@ export default function myPlugin(options = {}) {
209209
// do something with the declared names
210210
// e.g. for `const {x, y: z} = ...` => declaredNames = ['x', 'z']
211211
}
212-
},
212+
}
213213
});
214-
},
214+
}
215215
};
216216
}
217217
```

0 commit comments

Comments
 (0)