Skip to content

Commit

Permalink
Switch the entire codebase to tabs, for accessibility. Fixes #3098
Browse files Browse the repository at this point in the history
  • Loading branch information
zachleat committed Nov 11, 2023
1 parent 76113c5 commit 358ec48
Show file tree
Hide file tree
Showing 84 changed files with 13,670 additions and 13,669 deletions.
4 changes: 1 addition & 3 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
root = true

[*]
#TODO
#indent_style = tab
indent_style = space
indent_style = tab
indent_size = 2
end_of_line = lf
insert_final_newline = false
Expand Down
30 changes: 15 additions & 15 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
module.exports = {
env: {
es6: true,
node: true
},
extends: "eslint:recommended",
parserOptions: {
sourceType: "module",
ecmaVersion: 2017
},
rules: {
indent: ["error", 2],
"linebreak-style": ["error", "unix"],
quotes: ["error", "double"],
semi: ["error", "always"]
}
env: {
es6: true,
node: true,
},
extends: "eslint:recommended",
parserOptions: {
sourceType: "module",
ecmaVersion: 2017,
},
rules: {
indent: ["error", 2],
"linebreak-style": ["error", "unix"],
quotes: ["error", "double"],
semi: ["error", "always"],
},
};
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/enhancement.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ body:
attributes:
value: |
Before opening a feature request, please search for the feature in the existing issues.
---
Thank you for taking the time to file a feature request. To address this feature as fast as possible, we need some information.
- type: textarea
id: problem
Expand Down
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/possible-bug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ body:
attributes:
value: |
Before opening a bug report, please search for the behavior in the existing issues.
---
Thank you for taking the time to file a bug report. To address this bug as fast as possible, we need some information.
- type: input
id: os
Expand Down
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test
4 changes: 2 additions & 2 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"arrowParens": "always",
"printWidth": 100
"arrowParens": "always",
"printWidth": 100
}
246 changes: 124 additions & 122 deletions cmd.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,139 +5,141 @@

const pkg = require("./package.json");
require("please-upgrade-node")(pkg, {
message: function (requiredVersion) {
return (
"Eleventy " + pkg.version + " requires Node " +
requiredVersion +
". You will need to upgrade Node to use Eleventy!"
);
},
message: function (requiredVersion) {
return (
"Eleventy " +
pkg.version +
" requires Node " +
requiredVersion +
". You will need to upgrade Node to use Eleventy!"
);
},
});

const debug = require("debug")("Eleventy:cmd");

(async function() {
const { default: EleventyErrorHandler } = await import("./src/EleventyErrorHandler.js");
const { default: EleventyBaseError } = await import("./src/EleventyBaseError.js");
(async function () {
const { default: EleventyErrorHandler } = await import("./src/EleventyErrorHandler.js");
const { default: EleventyBaseError } = await import("./src/EleventyBaseError.js");

class EleventyCommandCheckError extends EleventyBaseError {}
class EleventyCommandCheckError extends EleventyBaseError {}

try {
let errorHandler = new EleventyErrorHandler();
const argv = require("minimist")(process.argv.slice(2), {
string: ["input", "output", "formats", "config", "pathprefix", "port", "to"],
boolean: [
"quiet",
"version",
"watch",
"dryrun",
"help",
"serve",
"incremental",
"ignore-initial",
],
default: {
quiet: null,
"ignore-initial": false,
},
unknown: function (unknownArgument) {
throw new EleventyCommandCheckError(
`We don’t know what '${unknownArgument}' is. Use --help to see the list of supported commands.`
);
},
});
try {
let errorHandler = new EleventyErrorHandler();
const argv = require("minimist")(process.argv.slice(2), {
string: ["input", "output", "formats", "config", "pathprefix", "port", "to"],
boolean: [
"quiet",
"version",
"watch",
"dryrun",
"help",
"serve",
"incremental",
"ignore-initial",
],
default: {
quiet: null,
"ignore-initial": false,
},
unknown: function (unknownArgument) {
throw new EleventyCommandCheckError(
`We don’t know what '${unknownArgument}' is. Use --help to see the list of supported commands.`,
);
},
});

debug("command: eleventy %o", argv);
const { Eleventy } = await import("./src/Eleventy.js");
debug("command: eleventy %o", argv);
const { Eleventy } = await import("./src/Eleventy.js");

process.on("unhandledRejection", (error, promise) => {
errorHandler.fatal(error, "Unhandled rejection in promise");
});
process.on("uncaughtException", (error) => {
errorHandler.fatal(error, "Uncaught exception");
});
process.on("rejectionHandled", (promise) => {
errorHandler.warn(promise, "A promise rejection was handled asynchronously");
});
process.on("unhandledRejection", (error, promise) => {
errorHandler.fatal(error, "Unhandled rejection in promise");
});
process.on("uncaughtException", (error) => {
errorHandler.fatal(error, "Uncaught exception");
});
process.on("rejectionHandled", (promise) => {
errorHandler.warn(promise, "A promise rejection was handled asynchronously");
});

if (argv.version) {
console.log(Eleventy.getVersion());
} else if (argv.help) {
console.log(Eleventy.getHelp());
} else {
let elev = new Eleventy(argv.input, argv.output, {
source: "cli",
// --quiet and --quiet=true both resolve to true
quietMode: argv.quiet,
configPath: argv.config,
pathPrefix: argv.pathprefix,
runMode: argv.serve ? "serve" : argv.watch ? "watch" : "build",
dryRun: argv.dryrun,
});
if (argv.version) {
console.log(Eleventy.getVersion());
} else if (argv.help) {
console.log(Eleventy.getHelp());
} else {
let elev = new Eleventy(argv.input, argv.output, {
source: "cli",
// --quiet and --quiet=true both resolve to true
quietMode: argv.quiet,
configPath: argv.config,
pathPrefix: argv.pathprefix,
runMode: argv.serve ? "serve" : argv.watch ? "watch" : "build",
dryRun: argv.dryrun,
});

// reuse ErrorHandler instance in Eleventy
errorHandler = elev.errorHandler;
// reuse ErrorHandler instance in Eleventy
errorHandler = elev.errorHandler;

// careful, we can’t use async/await here to error properly
// with old node versions in `please-upgrade-node` above.
elev
.init()
.then(function () {
if (argv.to === "json" || argv.to === "ndjson") {
// override logging output
elev.setIsVerbose(false);
}
// careful, we can’t use async/await here to error properly
// with old node versions in `please-upgrade-node` above.
elev
.init()
.then(function () {
if (argv.to === "json" || argv.to === "ndjson") {
// override logging output
elev.setIsVerbose(false);
}

elev.setIgnoreInitial(argv["ignore-initial"]);
elev.setIncrementalBuild(argv.incremental);
elev.setFormats(argv.formats);
elev.setIgnoreInitial(argv["ignore-initial"]);
elev.setIncrementalBuild(argv.incremental);
elev.setFormats(argv.formats);

try {
if (argv.serve) {
let shouldStartServer = true;
elev
.watch()
.catch((e) => {
// Build failed but error message already displayed.
shouldStartServer = false;
// A build error occurred and we aren’t going to --serve
errorHandler.fatal(e, "Eleventy CLI Error");
})
.then(function () {
if (shouldStartServer) {
elev.serve(argv.port);
}
});
} else if (argv.watch) {
elev.watch().catch((e) => {
// A build error occurred and we aren’t going to --watch
errorHandler.fatal(e, "Eleventy CLI Error");
});
} else {
if (argv.to === "json") {
elev.toJSON().then(function (result) {
console.log(JSON.stringify(result, null, 2));
});
} else if (argv.to === "ndjson") {
elev.toNDJSON().then(function (stream) {
stream.pipe(process.stdout);
});
} else if (!argv.to || argv.to === "fs") {
elev.write();
} else {
throw new EleventyCommandCheckError(
`Invalid --to value: ${argv.to}. Supported values: \`fs\` (default), \`json\`, and \`ndjson\`.`
);
}
}
} catch (e) {
errorHandler.fatal(e, "Eleventy CLI Error");
}
})
.catch(errorHandler.fatal.bind(errorHandler));
}
} catch (e) {
let errorHandler = new EleventyErrorHandler();
errorHandler.fatal(e, "Eleventy CLI Fatal Error");
}
try {
if (argv.serve) {
let shouldStartServer = true;
elev
.watch()
.catch((e) => {
// Build failed but error message already displayed.
shouldStartServer = false;
// A build error occurred and we aren’t going to --serve
errorHandler.fatal(e, "Eleventy CLI Error");
})
.then(function () {
if (shouldStartServer) {
elev.serve(argv.port);
}
});
} else if (argv.watch) {
elev.watch().catch((e) => {
// A build error occurred and we aren’t going to --watch
errorHandler.fatal(e, "Eleventy CLI Error");
});
} else {
if (argv.to === "json") {
elev.toJSON().then(function (result) {
console.log(JSON.stringify(result, null, 2));
});
} else if (argv.to === "ndjson") {
elev.toNDJSON().then(function (stream) {
stream.pipe(process.stdout);
});
} else if (!argv.to || argv.to === "fs") {
elev.write();
} else {
throw new EleventyCommandCheckError(
`Invalid --to value: ${argv.to}. Supported values: \`fs\` (default), \`json\`, and \`ndjson\`.`,
);
}
}
} catch (e) {
errorHandler.fatal(e, "Eleventy CLI Error");
}
})
.catch(errorHandler.fatal.bind(errorHandler));
}
} catch (e) {
let errorHandler = new EleventyErrorHandler();
errorHandler.fatal(e, "Eleventy CLI Fatal Error");
}
})();
20 changes: 10 additions & 10 deletions docs/eleventy.coverage.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ import { TemplatePath } from "@11ty/eleventy-utils";
const __dirname = dirname(fileURLToPath(import.meta.url));

export default function (eleventyConfig) {
eleventyConfig.addFilter("removeDir", function (str) {
return TemplatePath.stripLeadingSubPath(str, TemplatePath.join(__dirname, ".."));
});
eleventyConfig.addFilter("removeDir", function (str) {
return TemplatePath.stripLeadingSubPath(str, TemplatePath.join(__dirname, ".."));
});

return {
templateFormats: ["njk"],
dir: {
input: "docs/coverage.njk",
output: "docs/", // root relative
},
};
return {
templateFormats: ["njk"],
dir: {
input: "docs/coverage.njk",
output: "docs/", // root relative
},
};
}

0 comments on commit 358ec48

Please sign in to comment.