Skip to content

Commit

Permalink
Upgrade eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
jgerigmeyer committed Nov 8, 2024
1 parent e5e9f08 commit cad3b06
Show file tree
Hide file tree
Showing 17 changed files with 1,628 additions and 1,617 deletions.
13 changes: 0 additions & 13 deletions .eslintignore

This file was deleted.

190 changes: 0 additions & 190 deletions .eslintrc.yml

This file was deleted.

3 changes: 0 additions & 3 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,3 @@ updates:
- dependency-name: 'strip-indent'
update-types:
- 'version-update:semver-major'
- dependency-name: 'eslint'
update-types:
- 'version-update:semver-major'
15 changes: 0 additions & 15 deletions assets/js/.eslintrc.yml

This file was deleted.

1 change: 1 addition & 0 deletions assets/js/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ export const getSearchData = () => {
if (this.status >= 200 && this.status < 400) {
try {
data = JSON.parse(this.responseText);
// eslint-disable-next-line no-unused-vars
} catch (e) {
// swallow error
}
Expand Down
131 changes: 131 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
const babelParser = require('@babel/eslint-parser');
const js = require('@eslint/js');
const prettier = require('eslint-config-prettier');
const importPlugin = require('eslint-plugin-import');
const jest = require('eslint-plugin-jest');
const jestDOM = require('eslint-plugin-jest-dom');
const simpleImportSort = require('eslint-plugin-simple-import-sort');
const globals = require('globals');

module.exports = [
{
ignores: [
'.git/*',
'.nyc_output/*',
'.vscode/*',
'.yarn/*',
'.yarnrc.yml',
'coverage/*',
'dist/*',
'docs/*',
'herman/*',
'node_modules/*',
],
},
js.configs.recommended,
importPlugin.flatConfigs.recommended,
prettier,
{
files: ['**/*.{js,mjs,cjs,ts,cts,mts}'],
languageOptions: {
parser: babelParser,
globals: {
...globals.node,
...globals.es2021,
},
parserOptions: {
sourceType: 'script',
},
},
settings: {
'import/resolver': {
node: {},
webpack: {
config: {
resolve: {
modules: ['templates/client', 'scss', 'node_modules'],
alias: {
jquery: 'jquery/dist/jquery.slim',
nunjucks: 'nunjucks/browser/nunjucks-slim',
},
},
resolveLoader: {
alias: {
sassjson: 'sass-json-loader',
},
},
},
},
},
'import/external-module-folders': ['node_modules'],
},
rules: {
'no-console': 1,
'no-warning-comments': ['warn', { terms: ['todo', 'fixme', '@@@'] }],
'import/first': 'warn',
'import/newline-after-import': 'warn',
'import/no-duplicates': ['error', { 'prefer-inline': true }],
'import/order': [
'warn',
{ 'newlines-between': 'always', alphabetize: { order: 'asc' } },
],
'import/named': 'warn',
},
},
{
files: ['assets/js/**/*.{js,mjs,cjs,ts,cts,mts}'],
languageOptions: {
globals: {
...globals.browser,
...globals.commonjs,
...globals.jquery,
...globals.es2021,
},
parserOptions: {
sourceType: 'module',
},
},
plugins: { 'simple-import-sort': simpleImportSort },
rules: {
'simple-import-sort/imports': 'warn',
'simple-import-sort/exports': 'warn',
'import/order': 'off',
},
},
{
files: ['test/**/*.{js,ts}'],
languageOptions: {
globals: {
...globals.mocha,
...globals.es2021,
},
},
rules: {
'func-names': 'off',
},
},
{
files: ['test/clientjs/**/*.{js,ts}'],
languageOptions: {
globals: {
...jest.environments.globals.globals,
...globals.browser,
...globals.jquery,
...globals.es2021,
},
parserOptions: {
sourceType: 'module',
},
},
plugins: {
jest,
'jest-dom': jestDOM,
'simple-import-sort': simpleImportSort,
},
rules: {
'simple-import-sort/imports': 'warn',
'simple-import-sort/exports': 'warn',
'import/order': 'off',
},
},
];
1 change: 0 additions & 1 deletion lib/annotations/access.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ const { isProse } = require('./../utils/prose');
module.exports = (env) => {
const defaultPrivatePrefixTest = RegExp.prototype.test.bind(/^[_-]/);
const baseAccessFn =
// eslint-disable-next-line global-require
require('sassdoc/dist/annotation/annotations/access').default;
const baseAccess = baseAccessFn();

Expand Down
2 changes: 0 additions & 2 deletions lib/annotations/example.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ const beautifyOpts = {
*/
module.exports = (env) => {
const baseExampleFn =
// eslint-disable-next-line global-require
require('sassdoc/dist/annotation/annotations/example').default;
const baseExample = baseExampleFn();
let sass, sassCompilerPromise;
Expand Down Expand Up @@ -91,7 +90,6 @@ module.exports = (env) => {
const isString = typeof use === 'string';
const isObj = !isString && use.file && use.namespace;
if (isObj) {
// eslint-disable-next-line max-len
sassData = `@use '${use.file}' as ${use.namespace};\n${sassData}`;
} else if (isString) {
sassData = `@use '${use}';\n${sassData}`;
Expand Down
1 change: 0 additions & 1 deletion lib/utils/sass.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ const getSassImplementation = (env) => {
}
const sassPkg = env.herman?.sass?.implementation ?? 'sass';
try {
// eslint-disable-next-line global-require
return require(sassPkg);
} catch (err) /* istanbul ignore next */ {
env.logger.warn(
Expand Down
Loading

0 comments on commit cad3b06

Please sign in to comment.