Tim van der Lippe | 835724b | 2020-03-10 16:48:02 +0000 | [diff] [blame] | 1 | 'use strict'; |
| 2 | |
| 3 | const fs = require('fs'); |
| 4 | const path = require('path'); |
| 5 | const PACKAGE_NAME = require('./package').name; |
| 6 | |
| 7 | const SYMLINK_LOCATION = path.join(__dirname, 'node_modules', PACKAGE_NAME); |
| 8 | |
| 9 | // Symlink node_modules/{package name} to this directory |
| 10 | // so that ESLint resolves this plugin name correctly. |
| 11 | // (Yes, this plugin still has to hack node_modules to bootstrap itself.) |
| 12 | if (!fs.existsSync(SYMLINK_LOCATION)) { |
| 13 | fs.symlinkSync(__dirname, SYMLINK_LOCATION); |
| 14 | } |
| 15 | |
Jack Franklin | 32c8d82 | 2021-03-12 11:50:11 +0000 | [diff] [blame] | 16 | require('.').RULES_DIR = [path.resolve('fake-rule-dir-one'), path.resolve('fake-rule-dir-two')]; |
Tim van der Lippe | 835724b | 2020-03-10 16:48:02 +0000 | [diff] [blame] | 17 | |
| 18 | module.exports = { |
| 19 | extends: 'airbnb-base', |
| 20 | parserOptions: { |
| 21 | sourceType: 'script', |
| 22 | }, |
| 23 | rules: { |
| 24 | 'global-require': 'off', |
| 25 | 'import/no-dynamic-require': 'off', |
| 26 | 'rulesdir/fake-rule': 'error', |
Jack Franklin | 32c8d82 | 2021-03-12 11:50:11 +0000 | [diff] [blame] | 27 | 'rulesdir/another-fake-rule': 'error', |
Tim van der Lippe | 835724b | 2020-03-10 16:48:02 +0000 | [diff] [blame] | 28 | }, |
| 29 | plugins: [PACKAGE_NAME], |
| 30 | }; |