Skip to content

Commit

Permalink
feat(linter): added option to disable rules by default. Split H017 an…
Browse files Browse the repository at this point in the history
…d disabled by default

closes #372
  • Loading branch information
christopherpickering committed Apr 12, 2023
1 parent 95a3b7f commit 2dd3675
Show file tree
Hide file tree
Showing 17 changed files with 396 additions and 212 deletions.
62 changes: 54 additions & 8 deletions docs/.eleventy.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
const Image = require('@11ty/eleventy-img');
const syntaxHighlight = require('@11ty/eleventy-plugin-syntaxhighlight');
const criticalCss = require('eleventy-critical-css');
const slugify = require('slugify');
const metagen = require('eleventy-plugin-metagen');
const i18n = require('eleventy-plugin-i18n');
Expand All @@ -13,8 +12,10 @@ const editOnGithub = require('eleventy-plugin-edit-on-github');
const i18n_func = require('eleventy-plugin-i18n/i18n.js');
const rollupper = require('./src/_utils/rollupper');
const { nodeResolve } = require('@rollup/plugin-node-resolve');

process.setMaxListeners(0);
const eleventySass = require('eleventy-sass');
const pluginRev = require('eleventy-plugin-rev');
const purgecss = require('@fullhuman/postcss-purgecss');
const postcss = require('postcss');

const slugifyCustom = (s) =>
slugify(s, { lower: true, remove: /[*+~.()'"!:@]/g });
Expand Down Expand Up @@ -93,13 +94,14 @@ module.exports = function (eleventyConfig) {
eleventyConfig.addFilter('widont', widont);
eleventyConfig.addWatchTarget('./src/static/');
eleventyConfig.addNunjucksAsyncShortcode('image', imageShortcode);
eleventyConfig.addTransform(
'htmlmin',
require('./src/_utils/minify-html.js'),
);
if (process.env.ELEVENTY_PRODUCTION == true) {
eleventyConfig.addTransform(
'htmlmin',
require('./src/_utils/minify-html.js'),
);
}
eleventyConfig.addPlugin(syntaxHighlight);
eleventyConfig.addPlugin(metagen);
eleventyConfig.addPlugin(criticalCss);
eleventyConfig.addPlugin(schema);
eleventyConfig.addPlugin(rollupper, {
rollup: {
Expand Down Expand Up @@ -268,6 +270,50 @@ module.exports = function (eleventyConfig) {
return `${markdownIt.render(value)}`;
});

eleventyConfig.addPlugin(pluginRev);

eleventyConfig.addPlugin(eleventySass, [
{
rev: true,
postcss: postcss([
require('postcss-nested'),
purgecss({
content: ['./src/**/*.njk', './src/**/*.md', './src/**/*.js'],
safelist: {
deep: [
/headShake/,
/zoomIn/,
/fadeInUp/,
/pre/,
/code/,
/block/,
/box/,
/title/,
/is-\d/,
/table/,
/message/,
/message-header/,
/message-body/,
/panel-block/,
/p-3/,
/is-block/,
/is-justify-content-space-between/,
/is-light/,
/is-active/,
/is-info/,
/fa-*/,
/mr-1/,
/mr-2/,
/has-text-info/,
],
},
}),
require('autoprefixer'),
require('cssnano'),
]),
},
]);

const { fontawesomeSubset } = require('fontawesome-subset');
fontawesomeSubset(
{
Expand Down
94 changes: 88 additions & 6 deletions docs/package-lock.json

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

2 changes: 2 additions & 0 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
"codemirror": "^6.0.1",
"eleventy-critical-css": "^1.1.0",
"eleventy-plugin-i18n": "^0.1.3",
"eleventy-plugin-rev": "^1.1.1",
"eleventy-sass": "^2.2.1",
"md5": "^2.3.0",
"rollup": "^3.20.2"
},
Expand Down
18 changes: 18 additions & 0 deletions docs/src/_data/configuration.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,24 @@
}
]
},
{
"name": "include",
"description": {
"en": "Include linter codes.",
"ru": "Включите коды линтера.",
"fr": "Inclure les codes des liners."
},
"usage": [
{
"name": "pyproject.toml",
"value": "include=\"H014,H015\""
},
{
"name": ".djlintrc",
"value": "\"include\": \"H014,H015\""
}
]
},
{
"name": "extension",
"description": {
Expand Down
7 changes: 2 additions & 5 deletions docs/src/_includes/layout.njk
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,8 @@
<!-- languages -->
<link rel="alternate" hreflang="en-US" href="{{site.url}}{{ page.url | baseUrl }}" />
<link rel="alternate" hreflang="ru" href="{{site.url}}/ru{{ page.url | baseUrl }}" />

<!-- critical css is inlined, so we can async the rest -->
<link rel="stylesheet preload"
href="{{ css.stylesCss }}"
as="style" />
<link rel="stylesheet"
href="{{ "/static/css/site.css" | rev }}"/>
<link rel="preload"
href="/static/font/crimson-pro/files/crimson-pro-latin-400-normal.woff2"
as="font"
Expand Down
4 changes: 2 additions & 2 deletions docs/src/_includes/nav.njk
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,11 @@
<span class="icon is-large">
<i class="fas fa-lg fa-globe"></i>
</span>
<span>{{ locale | i18n_locale(locales) }}
<span>{{ locale | i18n_locale(locales) }}</span>
</div>
<div class="navbar-dropdown">
{% for page in page.url | i18n_urls(collections.all) %}
<a class="navbar-item" href="{{ page.url }}">{{ page.meta.label }}
<a class="navbar-item" href="{{ page.url }}">{{ page.meta.label }}</a>
{% endfor %}
</div>
</div>
Expand Down
63 changes: 0 additions & 63 deletions docs/src/_utils/styles.11ty.js

This file was deleted.

Loading

0 comments on commit 2dd3675

Please sign in to comment.