Skip to content

Commit

Permalink
Convert to new flat config for eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
dpilafian committed Aug 12, 2024
1 parent b4f7080 commit c2de2a9
Show file tree
Hide file tree
Showing 5 changed files with 146 additions and 107 deletions.
22 changes: 22 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// @ts-check

import eslint from '@eslint/js';
import tseslint from 'typescript-eslint';

export default [
eslint.configs.recommended,
...tseslint.configs.strictTypeChecked,
{ ignores: ['**/*.js'] },
{
languageOptions: { parserOptions: { projectService: true } },
rules: {
'@typescript-eslint/no-confusing-void-expression': 'off', //prefer minimal arrow functions
'@typescript-eslint/no-floating-promises': 'off', //annimations may be fire-and-forget
'@typescript-eslint/no-misused-promises': 'off', //annimations may be fire-and-forget
'@typescript-eslint/no-non-null-assertion': 'off', //ts cannot always know value exists
'@typescript-eslint/restrict-template-expressions': 'off', //numbers in templates are natural
'@typescript-eslint/unbound-method': 'off', //safer to not use 'this'
'@typescript-eslint/use-unknown-in-catch-callback-variable': 'off', //clarity over theoretical exceptions
},
},
];
57 changes: 20 additions & 37 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,56 +43,39 @@
"dna": false
}
},
"eslintConfig": {
"ignorePatterns": [
"build",
"dist",
"node_modules"
],
"root": true,
"parser": "@typescript-eslint/parser",
"plugins": [
"@typescript-eslint"
],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended"
],
"rules": {
"@typescript-eslint/no-non-null-assertion": "off"
}
},
"runScriptsConfig": {
"clean": [
"rimraf build dist"
],
"lint": [
"jshint . --exclude-path .gitignore",
"eslint --max-warnings 0 . --ext .ts"
"eslint --max-warnings 0"
],
"blogger": [
"lessc src/css/blogger-tweaks/style.less build/step3/blogger-tweaks.css",
"lessc src/css/blogger-tweaks/style.less build/step3/blogger-tweaks.css",
"replacer src/css/blogger-tweaks/instructions.css build/step4 --regex=/{{apos}}{{gt}}$/gm --replacement={{apos}}/{{gt}}",
"csso build/step3/blogger-tweaks.css --output build/step4/blogger-tweaks.min.css",
"replacer build/step4 --ext=.css build/step5 --concat=blogger-tweaks.min.css"
"csso build/step3/blogger-tweaks.css --output build/step4/blogger-tweaks.min.css",
"replacer build/step4 --ext=.css build/step5 --concat=blogger-tweaks.min.css"
],
"build": [
"tsc",
"lessc src/css/reset.less build/step1/reset.css",
"lessc src/css/reset.less build/step1/reset.css",
"copy-file src/css/reset-color-overrides.css --folder build/step2",
"csso build/step1/reset.css --output build/step2/core-reset.min.css",
"replacer build/step2 --ext=.css build/step5 --concat=reset.min.css",
"replacer src/css/layouts --ext=.css build/step5/layouts",
"copy-folder build/step0 build/step5",
"esm-to-plain-js build/step0/lib-x.js build/step5/lib-x.dev.js",
"uglifyjs build/step5/lib-x.dev.js --output build/step5/lib-x.min.js",
"uglifyjs src/css/layouts/neon.js --output build/step5/layouts/neon.min.js",
"add-dist-header build/step5 --recursive dist",
"csso build/step1/reset.css --output build/step2/core-reset.min.css",
"replacer build/step2 --ext=.css build/step5 --concat=reset.min.css",
"replacer src/css/layouts --ext=.css build/step5/layouts",
"copy-folder build/step0 build/step5",
"esm-to-plain-js build/step0/lib-x.js build/step5/lib-x.dev.js",
"uglifyjs build/step5/lib-x.dev.js --output build/step5/lib-x.min.js",
"uglifyjs src/css/layouts/neon.js --output build/step5/layouts/neon.min.js"
],
"publish": [
"add-dist-header build/step5 --recursive dist",
"copy-folder src/css/layouts/neon --ext=.jpg dist/layouts/neon"
]
},
"scripts": {
"pretest": "run-scripts clean lint blogger build",
"pretest": "run-scripts clean lint blogger build publish",
"test": "html-validator src && mocha spec/*.spec.js"
},
"dependencies": {
Expand All @@ -102,15 +85,15 @@
"hljs-enhance": "~2.0"
},
"devDependencies": {
"@eslint/js": "~9.8",
"@eslint/js": "~9.9",
"@fortawesome/fontawesome-free": "~6.6",
"@types/node": "~20.14",
"@types/node": "~22.2",
"add-dist-header": "~1.4",
"assert-deep-strict-equal": "~1.2",
"copy-file-util": "~1.2",
"copy-folder-util": "~1.1",
"csso-cli": "~4.0",
"eslint": "8.57.0",
"eslint": "~9.9",
"esm-to-plain-js": "~1.1",
"jshint": "~2.13",
"less": "~4.2",
Expand All @@ -119,7 +102,7 @@
"rimraf": "~6.0",
"run-scripts-util": "~1.3",
"typescript": "~5.5",
"typescript-eslint": "~7.17",
"typescript-eslint": "~8.0",
"uglify-js": "~3.19",
"w3c-html-validator": "~1.8"
}
Expand Down
2 changes: 1 addition & 1 deletion src/css/reset/forms.less
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,6 @@ fieldset {
font-weight: bold;
border: 1px solid silver;
border-radius: 1000px;
padding: 0.3em 1.0em;
padding: 0.3em 1.1em 0.3em 1.0em;
}
}
Loading

0 comments on commit c2de2a9

Please sign in to comment.