From 11fb9e0e185d98c738ad196a54c5b1ad84022ec7 Mon Sep 17 00:00:00 2001 From: Dan Dascalescu Date: Wed, 3 Jul 2024 19:43:14 +0300 Subject: [PATCH] Add ESLint flat config section --- README.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/README.md b/README.md index 52cb060..92f057f 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,30 @@ $ npm install eslint-plugin-googleappsscript --save-dev ## Usage +### ESLint flat config + +Add `import googleAppsScript from 'eslint-plugin-googleappsscript';` to `eslint.config.mjs`, +then the block for linting `.gs` files could look like this: + +```json + // Google Apps Script files + { + files: ['*.gs'], + languageOptions: { + ecmaVersion: 2020, // Google Apps Script is allegedly ES2018, but it does support ?., which requires 2020+ + sourceType: 'script', + globals: { + ...googleAppsScript.environments.googleappsscript.globals, + }, + }, + rules: { + // ... + } + }, +``` + +### ESLint legacy config + Add `googleappsscript` to the plugins section of your `.eslintrc` configuration file. You can omit the `eslint-plugin-` prefix. Also, add `googleappsscript/googleappsscript": true` to `env` section: