Enable linting of build scripts
This commit is contained in:
1 parent
21733e441d
commit
ba51d2dfa8
11 files changed
+218
-266
No files matched your search
@@ -0,0 +1,12 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = {
|
||||
overrides: [
|
||||
{
|
||||
files: "rollup.*.config.js",
|
||||
parserOptions: {
|
||||
sourceType: "module"
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
@@ -2,15 +2,15 @@ export default {
|
||||
onwarn: function(warning) {
|
||||
if (
|
||||
[
|
||||
'EVAL',
|
||||
'MISSING_GLOBAL_NAME',
|
||||
'MISSING_NODE_BUILTINS',
|
||||
'UNRESOLVED_IMPORT',
|
||||
"EVAL",
|
||||
"MISSING_GLOBAL_NAME",
|
||||
"MISSING_NODE_BUILTINS",
|
||||
"UNRESOLVED_IMPORT"
|
||||
].find(code => code === warning.code)
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
console.warn(warning.message);
|
||||
},
|
||||
}
|
||||
};
|
||||
@@ -1,23 +1,21 @@
|
||||
import baseConfig from './rollup.base.config.js';
|
||||
import resolve from 'rollup-plugin-node-resolve';
|
||||
import commonjs from 'rollup-plugin-commonjs';
|
||||
import json from 'rollup-plugin-json';
|
||||
import replace from 'rollup-plugin-replace';
|
||||
|
||||
const parser = process.env.parser;
|
||||
import baseConfig from "./rollup.base.config.js";
|
||||
import resolve from "rollup-plugin-node-resolve";
|
||||
import commonjs from "rollup-plugin-commonjs";
|
||||
import json from "rollup-plugin-json";
|
||||
import replace from "rollup-plugin-replace";
|
||||
|
||||
export default Object.assign(baseConfig, {
|
||||
entry: 'bin/prettier.js',
|
||||
dest: 'dist/bin/prettier.js',
|
||||
format: 'cjs',
|
||||
banner: '#!/usr/bin/env node',
|
||||
entry: "bin/prettier.js",
|
||||
dest: "dist/bin/prettier.js",
|
||||
format: "cjs",
|
||||
banner: "#!/usr/bin/env node",
|
||||
plugins: [
|
||||
replace({
|
||||
'#!/usr/bin/env node': '',
|
||||
"#!/usr/bin/env node": ""
|
||||
}),
|
||||
json(),
|
||||
resolve({ preferBuiltins: true }),
|
||||
commonjs(),
|
||||
commonjs()
|
||||
],
|
||||
external: ['fs', 'readline', 'path', 'module', 'assert', 'util', 'events'],
|
||||
external: ["fs", "readline", "path", "module", "assert", "util", "events"]
|
||||
});
|
||||
@@ -1,19 +1,19 @@
|
||||
import baseConfig from './rollup.base.config.js';
|
||||
import resolve from 'rollup-plugin-node-resolve';
|
||||
import commonjs from 'rollup-plugin-commonjs';
|
||||
import globals from 'rollup-plugin-node-globals';
|
||||
import json from 'rollup-plugin-json';
|
||||
import baseConfig from "./rollup.base.config.js";
|
||||
import resolve from "rollup-plugin-node-resolve";
|
||||
import commonjs from "rollup-plugin-commonjs";
|
||||
import globals from "rollup-plugin-node-globals";
|
||||
import json from "rollup-plugin-json";
|
||||
|
||||
const filepath = process.env.filepath;
|
||||
const filename = filepath.replace(/.+\//, '');
|
||||
const basename = filename.replace(/\..+/, '');
|
||||
const filename = filepath.replace(/.+\//, "");
|
||||
const basename = filename.replace(/\..+/, "");
|
||||
|
||||
export default Object.assign(baseConfig, {
|
||||
entry: 'dist/' + filepath,
|
||||
dest: 'docs/lib/' + filename,
|
||||
format: 'iife',
|
||||
entry: "dist/" + filepath,
|
||||
dest: "docs/lib/" + filename,
|
||||
format: "iife",
|
||||
plugins: [json(), resolve({ preferBuiltins: true }), commonjs(), globals()],
|
||||
useStrict: false,
|
||||
moduleName: basename.replace(/.+-/, ''),
|
||||
external: ['assert', 'fs', 'module'],
|
||||
moduleName: basename.replace(/.+-/, ""),
|
||||
external: ["assert", "fs", "module"]
|
||||
});
|
||||
@@ -1,12 +1,12 @@
|
||||
import baseConfig from './rollup.base.config.js';
|
||||
import resolve from 'rollup-plugin-node-resolve';
|
||||
import commonjs from 'rollup-plugin-commonjs';
|
||||
import json from 'rollup-plugin-json';
|
||||
import baseConfig from "./rollup.base.config.js";
|
||||
import resolve from "rollup-plugin-node-resolve";
|
||||
import commonjs from "rollup-plugin-commonjs";
|
||||
import json from "rollup-plugin-json";
|
||||
|
||||
export default Object.assign(baseConfig, {
|
||||
entry: 'index.js',
|
||||
dest: 'dist/index.js',
|
||||
format: 'cjs',
|
||||
entry: "index.js",
|
||||
dest: "dist/index.js",
|
||||
format: "cjs",
|
||||
plugins: [json(), resolve({ preferBuiltins: true }), commonjs()],
|
||||
external: ['assert'],
|
||||
external: ["assert"]
|
||||
});
|
||||
@@ -1,21 +1,21 @@
|
||||
import baseConfig from './rollup.base.config.js';
|
||||
import resolve from 'rollup-plugin-node-resolve';
|
||||
import commonjs from 'rollup-plugin-commonjs';
|
||||
import json from 'rollup-plugin-json';
|
||||
import replace from 'rollup-plugin-replace';
|
||||
import uglify from 'uglify-es';
|
||||
import baseConfig from "./rollup.base.config.js";
|
||||
import resolve from "rollup-plugin-node-resolve";
|
||||
import commonjs from "rollup-plugin-commonjs";
|
||||
import json from "rollup-plugin-json";
|
||||
import replace from "rollup-plugin-replace";
|
||||
import uglify from "uglify-es";
|
||||
|
||||
const parser = process.env.parser;
|
||||
|
||||
export default Object.assign(baseConfig, {
|
||||
entry: 'src/parser-' + parser + '.js',
|
||||
dest: 'dist/parser-' + parser + '.js',
|
||||
format: 'cjs',
|
||||
entry: "src/parser-" + parser + ".js",
|
||||
dest: "dist/parser-" + parser + ".js",
|
||||
format: "cjs",
|
||||
plugins: [
|
||||
parser === 'typescript'
|
||||
parser === "typescript"
|
||||
? replace({
|
||||
'exports.Syntax =': '1,',
|
||||
include: 'node_modules/typescript-eslint-parser/parser.js',
|
||||
"exports.Syntax =": "1,",
|
||||
include: "node_modules/typescript-eslint-parser/parser.js"
|
||||
})
|
||||
: {},
|
||||
json(),
|
||||
@@ -24,20 +24,22 @@ export default Object.assign(baseConfig, {
|
||||
{
|
||||
transformBundle(code) {
|
||||
const result = uglify.minify(code, {});
|
||||
if (result.error) throw result.error;
|
||||
if (result.error) {
|
||||
throw result.error;
|
||||
}
|
||||
return result;
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
],
|
||||
external: [
|
||||
'fs',
|
||||
'buffer',
|
||||
'path',
|
||||
'module',
|
||||
'assert',
|
||||
'util',
|
||||
'os',
|
||||
'crypto',
|
||||
"fs",
|
||||
"buffer",
|
||||
"path",
|
||||
"module",
|
||||
"assert",
|
||||
"util",
|
||||
"os",
|
||||
"crypto"
|
||||
],
|
||||
useStrict: parser === 'flow' ? false : true,
|
||||
useStrict: parser === "flow" ? false : true
|
||||
});
|
||||
Reference in new issue
Block a user