@nextcloud/eslint-config
Version:
Eslint shared config for nextcloud apps and libraries
46 lines (45 loc) • 1.23 kB
JavaScript
import jsonPlugin from '@eslint/json';
import { GLOB_FILES_JSON, GLOB_FILES_JSONC, GLOB_FILES_MS_JSON, } from "../globs.js";
import packageJsonPlugin from "../plugins/packageJson.js";
/**
* JSON related ESLint rules for Nextcloud
*/
export const json = [
{
language: 'json/json',
plugins: {
json: jsonPlugin,
'package-json': packageJsonPlugin,
},
rules: {
...jsonPlugin.configs.recommended.rules,
},
files: GLOB_FILES_JSON,
name: 'nextcloud/json',
},
// lint package.json files
{
files: ['**/package.json'],
language: 'json/json',
rules: {
'package-json/sort-package-json': 'error',
},
},
// Special handing of JSONC
{
files: GLOB_FILES_JSONC,
language: 'json/jsonc',
...jsonPlugin.configs.recommended,
name: 'nextcloud/jsonc',
},
// Microsoft specific JSONC (e.g. Typescript config)
{
files: GLOB_FILES_MS_JSON,
language: 'json/jsonc',
languageOptions: {
allowTrailingCommas: true,
},
...jsonPlugin.configs.recommended,
name: 'nextcloud/ms-json',
},
];